Re: mysql_error() (was Re: Getting last insert id?)

From: Date: Thu, 09 Oct 2003 16:35:59 +0000
Subject: Re: mysql_error() (was Re: Getting last insert id?)
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-30930@lists.php.net to get a copy of this message
http://www.php.net/manual/en/function.mysql-error.php Ben Edwards wrote:
On Thu, 2003-10-09 at 16:33, pete M wrote:
$new_id = mysql_query('select last_insert_id()'); your can also user it within a query - eg $sql = ' insert into related table parent_id, data , data2) values (last_insert_id(), 23, 45);
Is there also a similar way of getting the last error message, i.e. $new_id = mysql_query('select error()'); I currently am trying to solve the problem or mysql_error() returning nothing after an error. It may be something to do with globals and something like the above may help. Ben


« previous php.db (#30930) next »