I'm just starting to play with PHP and MySQL, kind of getting my head around it, but one thing I'm not getting (right) is delivery of a subset of the found records from MySQL. ie if 100 are found how do I get records 1-10 (or 11-20...).
What I have so far is: <?php $db = mysql_connect("host", "pass"); mysql_select_db("database",$db); ?> ... <?php $result = mysql_query("SELECT * FROM table",$db); $num_rows = mysql_num_rows($result); echo "$num_rows Rows\n"; echo "<table border=1>"; echo "<tr><td>Name</td><td>Position</tr>\n"; while ($myrow = mysql_fetch_row($result)) { printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow[1], $myrow[2], $myrow[3]); } echo "</table>\n"; ?> However, this delivers all 10,000+ rows on one HTML page. I have worked out how to use "LIMIT" as an SQL command: $result = mysql_query("SELECT * FROM url LIMIT 10, 10",$db); ie start at record 10 and show the next 10. But this delivers back "10" as the $num_rows variable, when I want the total number of rows. I don't really have to complete two querys to get the appropriate values do I? I'm running PHP 4.2.1 on MacOS X 10.1.4. TIA -- Clive -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php