Hello all,

I seem to be having a problem with pagination. I would like to have pictures and information in boxes pulled from the database, but have 4 of them in a row, making a total of 8 put on each page. Can anyone help me figure this out?

Thanks in advance,


include ("databaseinfo.php");


//count number of records 
$result = mysql_query("SELECT * FROM $category_sq WHERE active=\"1\"");
$num_rows = mysql_num_rows($result);
if(mysql_num_rows($result) == 0) {
  echo "<font size=\"4\" face=\"Arial\"><center>No results were found.</center>";

//number you want to display per page
//count number of pages
//This tells us the page number of last page
//How many pages
//determine results
//This checks to see if there's a page number.  If not, it will set it to page 1.
if(isset($_GET['pagenum'])) {
if(($pagenum<1) || ($pagenum>$last)) $pageNum=1;

echo "<table style=\"FONT-SIZE: 11pt\" face=\"Arial\" align=center border=\"1\" cellspacing=\"10\">";
echo "<tbody>";
echo "<tr>";

$sql="SELECT * FROM $category_sq WHERE active=\"1\"";
while ($row = mysql_fetch_assoc($result)) 

echo "<td><center><a href=\"http://www.thissite.com/folder/item.php?ID=$propnum\"><img src='$thumb' border=\"0\"></a><br>";
echo "<a href=\"http://www.thissite.com/folder/item.php?ID=$propnum\">";
echo $line1;
echo "<br>";
echo $line2;
echo "<br>";
echo $by;
echo "</a>";
echo "</td>";
echo "</center>";

echo "</tr>";
echo "</tbody>";
echo "</table>";

//This shows what page user's on and total pages
echo "<br><br>";

"--Page $pagenum of $last--<p>";
//Create links
if ($pagenum ==1)
echo "<a href='{$_SERVER['PHP_SELF']}?category=$category_sq&amp;pagenum=1'> <<-First</a> ";
echo " ";
echo "<a href='{$_SERVER['PHP_SELF']}?category=$category_sq&amp;pagenum=$previous'> <-Previous</a> ";
//This checks if on last page and generates links
if ($pagenum ==$last)
else {
$next = $pagenum+1;
echo "<a href='{$_SERVER['PHP_SELF']}?category=$category_sq&amp;pagenum=$next'>Next -></a>";
echo " ";
echo "<a href='{$_SERVER['PHP_SELF']}?category=$category_sq&amp;pagenum=$last'>Last ->></a>";

No worries...I got it figured out myself.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.