Jump to content

Select 40 results, and make a second page if more?..


cs.punk

Recommended Posts

Hey guys, retrieving the information from that database goes 100% but you can't output all the the results on one page. But how exactly does one go about doing it?...

 

Any ideas?

 

Heres my code:

<?php
include "files/maintainence_check.php";
include "files/stripslashes_mq.php";
session_start();
include "files/mysqlcon.php"; 
include "files/filterget.php";

if (!isset($_GET['catid']))
{header("Location: index.php");
}
else
{$catid = "{$_GET['catid']}";
}

$con = mysqli_connect ("$dbhost","$dbuser","$dbpass","$dbname")
   or die ("Could not connect to server");
   
$sac = "SELECT * FROM ad_posts WHERE cat_id = '$catid' ORDER BY ad_date DESC";
$e_sac = mysqli_query($con,$sac)
              or die ("Could not execute \"SELECT * FROM categories\" query." . mysql_error());
	  
echo "<p class=\"smallheading\">";

if (mysqli_num_rows($e_sac) >= 1)
{while ($row = mysqli_fetch_assoc($e_sac))
   {$date = strtotime("$row[ad_date]");
    $row[ad_date] = date("h:i a d/m/y", $date);
    echo "<a href=\"ads.php?adid=$row[ad_id]\">$row[ad_title]</a> 
              $row[ad_price] ($row[ad_date])
             <br/>";
   }
}
else
{echo "<p align=\"center\" class=\"smallheading\">Category ID is invalid!</p>";
}

echo "</p>";

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.