Re: last entry in mysql
| From: | Phillip Oertel | Date: | Fri, 14 Dec 2001 17:46:44 +0000 |
| Subject: | Re: last entry in mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-77765@lists.php.net to get a copy of this message | ||
Yoed Anis wrote:
hey guys, quick question I'm having trouble finding an answer too. In a mysql database, how can I select that last row entry. This might be done mins after i put that entry there and i tried to use: $lastid=mysql_insert_id(); to get the last id but to no avail. Thanks YoedRT*M " mysql_insert_id() returns 0 if the previous query does not generate an AUTO_INCREMENT value. If you need to save the value for later, be sure to call mysql_insert_id() immediately after the query that generates the value. " could that be your problem ?