Dear list, I would like to query on the first page only the last 50 records/rows (order by ID desc) in the following script file which uses MySQL, and I want to have NEXT page for the 50 rows earlier than last 50 queried and continue similarly. I think I can use JavaScript for BACK page to go back. Could you pl add for me the script to implement NEXT page or suggest me. There is LIMIT clause to use, but I only know to use it to limit to certain number of query/rows.
Here is the script file: <html> <body> <?php $db = mysql_connect("localhost", "root", "root"); mysql_select_db("penpal",$db); if ($id) $result = mysql_query("select * from penpal where id = $id",$db); $myrow = mysql_fetch_array($result); printf("<b>ID:</b> %s\n<br>", $myrow["id"]); printf("<b>Name:</b> %s\n<br>", $myrow["name"]); printf("<b>Age/Sex/Location:</b> %s\n<br>", $myrow["asl"]); printf("<b>Description:</b> %s\n<br>", $myrow["description"]); printf("<b>Email:</b> %s\n<br>", $myrow["email"]); } else { $result = mysql_query("select * from penpal order by id desc", $db); if ($myrow = mysql_fetch_array($result)) { do { printf("<a href = \"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["name"], $myrow["asl"]); } while ($myrow = mysql_fetch_array($result)); } else { echo "Sorry, no records"; } } ?> </body> </html> Thank you in advance. NOBBY --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php