note 40239 deleted from function.mysql-insert-id by cmb
| From: | cmb@php.net | Date: | Sun, 16 Feb 2020 13:28:51 +0000 |
| Subject: | note 40239 deleted from function.mysql-insert-id by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214111@lists.php.net to get a copy of this message | ||
Note Submitter: Wayne Theisinger
----
In response to treylane at example dot com.
It is very very very important that you put in an "or die" or some other form of error
handling.
Some scripts can fail invisibly and insert invalid data throughout your whole database because of
mysql_insert_id
inserting the last successful insertid rather than reporting that the last attempt failed.
example of an or die statement.
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
$EventID = mysql_insert_id();