Re: Listing a table
| From: | Matt | Date: | Wed, 20 Nov 2002 01:43:06 +0000 |
| Subject: | Re: Listing a table | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125177@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Marco Bleeker" <marco_bleeker@hetnet.nl>
To: <php-general@lists.php.net>
Sent: Tuesday, November 19, 2002 8:34 PM
Subject: [PHP] Listing a table
> Hello, how would I go about listing a portion of a MySQL table, without an
> overall selection criterium? I have a unique index field, but it's a
string
> and not autoincremented (but manually and with gaps). I just want to go to
> one particular row (query on that index field) and then list, say, 20 rows
> before that point and 20 rows after it. So I can create an output of 41
> rows in a HTML table. Is there something like the dBase SKIP and GOTO
> command? Should I do a query for each individual row (and get 41 result
> sets) or can I somehow walk through 1 result set ?
Use limit. To get first 20 rows:
"Select * from mytable order by index_field limit 0,20"
Next 20 rows:
"Select * from mytable order by index_field limit 20,20"
etc