Re[2]: [PHP] How to get the auto-incremented value?
| From: | Richard Davey | Date: | Mon, 01 Mar 2004 13:19:37 +0000 |
| Subject: | Re[2]: [PHP] How to get the auto-incremented value? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-179162@lists.php.net to get a copy of this message | ||
Hello Angelo,
Monday, March 1, 2004, 1:18:51 PM, you wrote:
AZ> When I write a record to a MySQL db with an auto-incremented key
AZ> column, say it's called "id", what's the easy to retrieve that value?
AZ> Do I have to run a query?
AZ> run a query:
AZ> select query from table order by id desc
Why waste time running another query? Get the value from
mysql_insert_id() instead.
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html