Re[2]: [PHP-DB] Limit in SELECT query.
| From: | David Tod Sigafoos | Date: | Fri, 24 Nov 2000 16:04:39 +0000 |
| Subject: | Re[2]: [PHP-DB] Limit in SELECT query. | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4724@lists.php.net to get a copy of this message | ||
MR> But what if i want to make something like:
MR> prev 1 2 3 4 next total records: 45
MR> and each number to be a link to that group of 10 records ?
MR> Must i first get the number of all records, and then query again the DB with
MR> that limit ?
MR> SELECT fields FROM table WHERE field=condition LIMIT 0,10
If you are using Mysql then mysql_num_rows() will return the number of
rows from your select (update,insert and delete use
mysql_affected_rows() )
So do you select then set a var to Mysql_Num_Rows() THEN start your
loop with limit StartRow,NumOfRows
This should do it for you
--
DSig
David Tod Sigafoos
mailto:dsig@teleport.com