RE: [PHP] auto increment
| From: | Chris W. Parker | Date: | Tue, 17 Feb 2004 19:52:17 +0000 |
| Subject: | RE: [PHP] auto increment | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-178013@lists.php.net to get a copy of this message | ||
BAO RuiXian <mailto:ruixian.bao@pp.inet.fi>
on Tuesday, February 17, 2004 11:32 AM said:
> If the id is auto increment, can't you use max(id) to get the last
> inserted one?
only if you are the absolute only person that will ever be connected to
that db at one time. otherwise the answer is no.
what if in between your INSERT INTO statement and your SELECT statement
someone else writes a record? for a high traffic website it's very
possible that someone will insert another record before you can turn
around and read the table.
does that help?
chris.