In article <009a01c21da7$7c215b60$1300a8c0@redplanet> , [EMAIL PROTECTED] (Aqua) wrote:
>I have 100 records in mySQL database and I need to display them in my web >page using php and html. How to display them in multiple pages? Each page >must contain 25 records. Does anyone know how to do it other than create 4 >pages and manually list the records there? or maybe point me some reference >please. Your help will be much appreciated. Thanks! Search MySQL's site or PHPBuilder/WeberDev/etc for an example of the LIMIT clause. Or, very briefly: <?php if (!isset($start)){ $start = 0; $limit = 25; } $query = "select blah from mytable limit $start, $limit"; $records = mysql_query($query) or error_log(mysql_error()); #check http error_log for errors! while (list($blah) = mysql_fetch_row($records)){ echo "$blah<BR>\n"; } echo "<A HREF=samepage.php?start=", $start - 25, ">Prev</A>"; echo "<A HREF=samepage.php?start=", $start + 25, ">Next</A>"; ?> You'll want to check that you don't go over 100 or under 0, and that there actually *IS* a Next/Prev page, but this is the core of it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php