I have a custom classified script, but it doesn't make the ads go to a different page after so many of them.
I'm trying to get some type of code that when there are 15 ads on one page, the lower ads (Posted earlier) go to the second page, and continue that.
Can anyone help?
My code for the page where it shows all the ads is:
<?php
require('header.php');
echo '<img src="images/2spacer.gif"><center><img src="images/ads.gif"></center>';
//If $_GET['cat'] isn't set...
if(!isset($_GET['cat']) || $_GET['cat'] == '')
echo 'No ads in this category. Please try again.'; //Print the error and stop.
//Otherwise...
else
{
//Grab all the ads in the category, and show 'em. Order them by views if $_GET['Hot'] == 'true'; else, order them by date
$sql->query("SELECT * FROM ads WHERE category = '%s' ORDER BY ".(($_GET['Hot'] == 'true') ? "views" : "date")." DESC", $_GET['cat']);
if($sql->num_rows() == 0)
echo 'Sorry. There are no ads in this category. Please try again later.';
foreach($sql->getrowset() as $ad)
{
$ad2 = new CAd($sql);
$ad2->LoadAd($ad['ID']);
echo $ad2->OutputAd();
}
}
require('footer.php');
?>
What do I need to change?
Thanks! 🙂