RE: [PHP] prev page, next page
| From: | Christopher Thompson | Date: | Sat, 01 Jul 2000 03:58:10 +0000 |
| Subject: | RE: [PHP] prev page, next page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4217@lists.php.net to get a copy of this message | ||
Thank you Torsten for making be research a little to find the answer. The
fast way to find the number of rows in a table in MySQL is:
select count(*) as num from mytable;
> -----Original Message-----
> From: Torsten Curdt [mailto:tcurdt@dff.st]
> Sent: Friday, June 30, 2000 6:36 AM
> To: PHP-General
> Subject: [PHP] prev page, next page
>
>
> I want to create a "prev page" "next page"
> functionality...
>
> [thread from PHP-DB]
> > If you remove the LIMIT 0,5 from your query you will get all of
> > the rows by
> > using mysql_num_rows. Since you have LIMIT 0,5 on their now,
> 5 rows are
> > returned from the query, thus there are 5 rows in your result
> set (hence,
> > the 5 returned from mysql_num_rows).
>
> Do I really need to make two queries to obtain the number of rows for
>
> SELECT * FROM tblArtikel ORDER BY artID
> maxrows = mysql_num_rows
>
> to know when to stop when iterating with
>
> SELECT * FROM tblArtikel ORDER BY artID LIMIT 0,5
> <next button>
> SELECT * FROM tblArtikel ORDER BY artID LIMIT 5,5
> <next button>
> SELECT * FROM tblArtikel ORDER BY artID LIMIT 10,5
> ...
> --
> Torsten
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>