Jump to content


Ads in between fetched rows....


2 replies to this topic

#1 drcrazy4

    Young Padawan

  • Members
  • Pip
  • 98 posts

Posted 11 February 2007 - 01:38 PM

I am pretty good at PHP but I am not sure how I would go about this. Basically just like on Pixel2Life there are ads after a certain amount of tutorials fetched from the database then the rest of the tutorials are listed. If you could help me out, even just by telling me what to do that would be really great.

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 11 February 2007 - 04:10 PM

I've done it like this.

$query = mysql_query("SELECT * FROM `tutorials`") or die(mysql_error());
$adNum = 4; // Whatever number you want
$count = 0;
while($r = mysql_fetch_array($query)){
if($count == $adNum){
// Echo Ad
$adNum = 0;
}
else $adNum++;
// Echo Tutorial
}


#3 drcrazy4

    Young Padawan

  • Members
  • Pip
  • 98 posts

Posted 11 February 2007 - 04:40 PM

Oh wow thats a really easy way of doing it. Thanks for the help.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users