It looks like your adding 10 to 8 thus getting 18... of course I maybe looking at this wrong
----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 02, 2003 9:23 AM Subject: [PHP] PHP and Mysql Limit > > I've created a script that reads a sorted mysql query and outputs specific > results into text files defined by the start and limit of mysql. The > database holds 178 records. I want to start my output on #9 with 10 > records per page. Should leave me with 17 equal pages right? > > $count = 178 > $start = 8; (Mysql starts at record 0) > $per_page = 10; > $page = 1; > > while ($start <= $count) { > > $fp = fopen("Page$page.txt", "w"); > > mysql_connect ($host, $user, $pass); > > mysql_select_db ($database); > > $result = mysql_query ("SELECT * FROM internal_listings, agents WHERE > internal_listings.agent = agents.name AND category = 'Standard' ORDER by > area,price LIMIT $start, $per_page"); > > if ($row = mysql_fetch_array($result)) { > > do { > > ##misc ouput to file $fp for 10 records in query > > } > > while($row = mysql_fetch_array($result)); > > } > > fclose($fp); > > mysql_close(); > > $start = $start + $per_page; > > $page++; > > } > > > When I run the script outlined above I get 18 pages. Page number 18 is > blank as it should be as there should be no more listings to output to a > text file but why is there a page number 18 to begin with? It should end > with page number 17. > > Thanks in advance for any insight, > > Ed > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php