Re: last ten from mysql?
| From: | Jason Stechschulte | Date: | Thu, 13 Jul 2000 13:33:10 +0000 |
| Subject: | Re: last ten from mysql? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6431@lists.php.net to get a copy of this message | ||
-----Original Message-----
From: Jason Stechschulte [mailto:jpstech@nc.edu]
Sent: Thursday, July 13, 2000 9:32 AM
To: Mike Bosschaert
Subject: RE: [PHP] last ten from mysql?
I could be wrong, but if you do much deleting and inserting of records in
the database, neither of these will definitely give you the last 10 records.
To do this you need to have an auto_increment column. If this column is
called number then your query would look like this:
select * from table order by number desc limit 10;
This should always give you the last 10 records in the table.
Jason Stechschulte
jpstech@nc.edu
-----Original Message-----
From: Mike Bosschaert [mailto:mbosschaert@yakult.nl]
Sent: Thursday, July 13, 2000 9:11 AM
To: php-general@lists.php.net
Subject: Re: [PHP] last ten from mysql?
1. get number to start with: $start=mysql_num_rows($result)-10
2. include LIMIT statement in you SQL query: SELECT bla bla FROM bla WHERE
bla
bla LIMIT $start, 10
Mike
>I just want to select the last ten rows from a mysql
>database on a php page... what command would i use???
--
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