Apr
29
2008
0

Insert Ads Between MySQL Results

If you are pulling information from a mysql database and want to insert either ads (like adsense) or just repeat the headers after every X amount of results, here's my way of doing it:

<?
//connect to the mysql database\
//I always like to define the value of $i as 0 just to keep things straight in my mind.  You can set this to whatever number you want to start counting from
$i=0;
 
//The query -- this is an example from one of my sites.
$result55 = mysql_query("SELECT * FROM table WHERE safe='y' AND language='english' ORDER BY timedate DESC LIMIT 10");
 
//Do the basic while statement
while($row = mysql_fetch_array($result55))
{
//Set the count of $i to plus 1
$i++;
//echo your results
echo $row[id];
//create an if statement and print out an ad on whatever number you like.  Since I limited my query to ten results, I'm going to print an ad after the 5th result (in the middle, obviously).  Note that adsense will only allow you to print three ads on any given page.
if ($i == "5"){ ?>
INSERT ADSENSE CODE HERE
<?
}
?>
 

See a working demo of this at www.SecretTweet.com -- the ad script is repeated after every 3rd ad when the query limits the results to 10. This way I can achieve the maximum number of ads allowed by google while spreading out the ads evenly within the results.

Written by Kevin in: MySQL, PHP, WebDev
Apr
05
2008
0
Apr
05
2008
1

Personal Review of Firefox 3 Beta 5 & Screenshots

I recently downloaded Firefox 3 Beta 5 (the supposed last stage of beta for the new browser) and, after a few hours of usage, decided to note a few things about it.  I'm no professional developer or anything; I'm just sharing my opinion on things.

Firefox 3 Screenshot

What I'm Sure I Like:
GMail is much faster.

Firefox 3 Screenshot
The Applications tab in Options.  Makes me happy.

Firefox 3 Screenshot
The new Page Info options.
The new Malware Protection.  ThumbsUp!

Firefox 3 Screenshot
Multiple text selects via the control key.

Firefox 3 Screenshot
The new download manager.  It's clean and you can pause/resume downloads efficiently...awesome.


What I'm Sure I Don't Like:
Folder menus seem to lag quite heavily sometimes.  This might have been my computer having a blonde moment, though.
Only one of my extensions for FF2 had an upgrade...but this has nothing to do with Firefox..I just don't like it lol.

Firefox 3 Screenshot
The default theme's back-forward navigation buttons -- They're soooo close together I found myself repeatedly hitting back instead of forward (and forward instead of back).  Eventually, I went to Backspace and Shift+Backspace.


What I'm Unsure About:
Smart Bookmarks -- While it's a nice idea, put most used bookmarks and recently visited sites in a folder on the quick links bar totally eliminates the usefullness for me.  I have most most visited sites on my quicklinks bar already.  And if they would have left the recently visited/address bar alone, there wouldn't be a problem in the first place.  Which leads me to my next point:

Firefox 3 Screenshot
The new recently visited dropdown address bar
Firefox 3 Screenshot
Tabscrolling forward and reverse.  It just doesn't seem efficient to me.
Firefox 3 Screenshot
Bookmark tagging (just like del.icio.us and other services) -- Good idea for webservices but I'd rather stick to the basics with my applications.


What I'm Indifferent About:
Firefox 3 Screenshot
The hyped "One-Click Site Info!" -- this was available before (with two clicks) and really doesn't have that much of an impact on me.

Written by Kevin in: Misc., Personal, WebDev
Apr
05
2008
0

Upgrading Wordpress ED: done.

I'm upgrading wordpress so things might be hairy for a few hours..

Just upgraded from wordpress 2.3 to 2.5 -- the admin area has a few changes.  The biggest change is the style and placement of everything.  I like it and will adjust quickly but I really wish I could move my category selection box to the side nav again...I hate having it at the bottom.  Other than that, I'm pleased...I really like the new autoupdate feature for plugins (is this new or have I overlooked it for this long?)...

Written by Kevin in: Misc., Personal
Apr
02
2008
0

My Latest Project: SecretTweet.com - Anonymous Twitter App

I started on this last night around 10pm and had the basic code finished around midnight. It's fairly simple (and yes, another Twitter application): a user goes to www.SecretTweet.com and types in a secret. Their secret "tweet" is then published to @secrettweet. It's kind of like postsectret but for Twitter. I might add some features to it in the future...it all depends on the popularity.

Written by Kevin in: PHP, Personal, Uncategorized
Apr
01
2008
0

I’m On Tumblr

I want to keep this as free as possibly from my other online activities; therefor, I have created a tumblr account that will host all of my twitter updates, all of my photoblog updates, all of my del.icio.us bookmarks, all of my youtube videos (rare), and all of the posts to this blog in one single place. It's very simple and rather unorganized....it gets the job done, though.

mozunk.tumblr.com

Written by Kevin in: Personal
Apr
01
2008
0

Javascript Expand/Collapse Element

Note: This piece of code wasn't entirely created by me. Also, I don't claim to be knowledgeable in javascript...I'm just sharing.

function expandCollapse() {
for (var i=0; i<expandCollapse. »
arguments.length; i++) {
var element = document.getElementById »
(expandCollapse.arguments[i]);
element.style.display = (element.style. »
display == "none") ? "block" : "none";
	}
}

Which will allow you to expand and collapse a div in css. I needed this for a new addition to VisitMatewan.com that I'm working on. Handy....

Written by Kevin in: Javascript, WebDev

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes