Why don't you let mysql sort and limit the records for you? That's easy enough. Just keep track of where you are in the database and select only the records that you need.
----- Original Message ----- From: James Kupernik <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 3:20 PM Subject: [PHP-DB] results on multiple pages I am retrieve records from my MySQL table and I want to display the results 12 per page along with allow for a sort. I was just send a query to the table with a limit each time, but it didn't sort all the records, so I need to load all the results into a table to sort then display. Here is what I have for code.... <?php Mysql_connect("localhost","user","pass"); mysql_select_db("countryloft"); if (!$nextpg) { $i = 0; } else { $i = $i + 12; } $prodTbl = mysql_query("select * FROM countryloft WHERE category LIKE '%folk%' ORDER BY displayorder"); $num_results = mysql_num_rows($prodTbl); $itemsPerPage = 12; echo "<table>"; $mycolumn = 1; $maxcolumn = 3; file://loop table until end of results for ($i=$i; $i < $itemsPerPage; $i++) { $row = mysql_fetch_array($prodTbl); echo "<td width=200 align=center><a href=productinfo.php?prodID=".$row['record']."><img src=http://www.thecountryloft.com/countryloft/yellowpics/".$row['image3']." border=0>"; echo "<br><font size=2>".$row['title']."</font>"; echo "<br><font size=2>".$row['price']."</font></td>\n"; if ($mycolumn == $maxcolumn) { echo "</tr>"; } $mycolumn = $mycolumn + 1; if ($mycolumn > $maxcolumn) { $mycolumn = 1; } } echo "</table>\n"; echo "<a href=$PHP_SELF?i=$i&nextpg=yes>Next Page</a>"; ?> Any help would be great!! Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php