rhock_95 Posted March 9, 2008 Share Posted March 9, 2008 anyone have a snippet that will display a (default text ad) string the same as a $row result in a while loop ? I would like to display a Google Adsense Ad about every 10 row or so... TIA Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 9, 2008 Share Posted March 9, 2008 i would count the lines of output and whenever the line count divided by 10 leaves no remainder, i would echo or include the google adsense code. Quote Link to comment Share on other sites More sharing options...
corbin Posted March 9, 2008 Share Posted March 9, 2008 $i = 0; while(<some condition>) { if($i % 10 == 0) { //number evenly divided by 10 } $i++; } Or: $i = 0; while(<some condition>) { if($i == 10) { $i = 0; //number is 10 } $i++; } Quote Link to comment Share on other sites More sharing options...
rhock_95 Posted March 9, 2008 Author Share Posted March 9, 2008 $i = 0; while(<some condition>) { if($i % 10 == 0) { //number evenly divided by 10 } $i++; } Or: $i = 0; while(<some condition>) { if($i == 10) { $i = 0; //number is 10 } $i++; } OK thanks...but I am going to need more information on how to use this... my current "While" statement looks like: while ($row=mysql_fetch_array($result)) how is this effected? also... where in the if statement where/how would I echo the Adsense text string? thanks again... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.