loop control for record navigation
Posted: Wed Jul 03, 2002 5:20 am
this is what i have so far. its a working loop which displays each requested item's attributes in a table (within a larger table):
what i want to do is limit the number of times the loop is run to 4 (therefore limiting the number of returned items to 4). and i want to learn how to set up navigation links below the results (like: next page, previous page, first, last) where these links display the next (prev etc) set of 4 results. how can i do this??
Code: Select all
<?php
echo "<table width="100%" border="0" cellspacing="0" cellpadding="0">\n"; // begin master table
echo "<tr>\n"; // begin master table's one and only row
while($row_Recordset1 = mysql_fetch_assoc($Recordset1))
{ // start while loop
$image = $row_Recordset1ї'image']; // define image number for each loop
if($genre = "comedy")
{ // start if loop
echo "<td>\n"; // begin master table column to be repeated by loop
echo "<table width="100%" border="0" cellspacing="0">\n"; //begin sub-table
echo "<tr>\n"; // start sub-table row 1
echo "<A href=backs/$image.jpg><div align="center"><IMG SRC=images/$image.jpg></A></div>\n"; // insert dynamic image
echo "\n"; //end sub-table row 1
echo "\n"; // start sub-table row 2
echo "<br><div align="center">".$row_Recordset1ї'title']."</div>\n"; // insert dynamic text
echo "\n"; // end sub-table row 2
echo "\n"; // sub-table row 3
echo "<br><div align="center">".$row_Recordset1ї'format']."</div>\n"; // insert dynamic text
echo "\n"; // end sub-table row 3
echo "</table>\n"; // end sub-table
echo "</td>\n"; //end master table column
}
}
echo "</tr>\n"; // end master table row
echo "</table>\n"; // end master table
?>