RE: [PHP] How do you select?
| From: | Jon Haworth | Date: | Thu, 31 Oct 2002 13:20:30 +0000 |
| Subject: | RE: [PHP] How do you select? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-122248@lists.php.net to get a copy of this message | ||
Hi Steve,
> I want to the select the very last record from
> my MySQL DB. How do I do it?
Depends what you mean by "last". You can either do a select with an order
and a limit:
SELECT foo FROM bar ORDER BY timestamp DESC LIMIT 1
Or you can get the last primary key with PHP's mysql_insert_id() function.
Cheers
Jon