note 50170 added to function.mysql-insert-id
| From: | relic at daimi dot au dot dk | Date: | Sun, 20 Feb 2005 14:57:49 +0000 |
| Subject: | note 50170 added to function.mysql-insert-id | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85283@lists.php.net to get a copy of this message | ||
A bit more on return values:
mysql_insert_id() returns 0 if you haven't actually manipulated anything yet.
Also, it returns 0 even if the DB connection is lost[0] between inserting and calling
mysql_insert_id() - so you can always count on getting an integer.
[0] By 'lost' I mean e.g. a DB crash. Actually closing the open link and then trying to
communicate with the DB will of course result in an error.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-insert-id.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50170
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50170&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50170&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50170&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50170&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50170&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50170&report=yes
Search -- http://master.php.net/manage/user-notes.php