MySQL Forums
Forum List  »  Quality Assurance

no mysql_insert_id() after $this->db->setQuery( "INSERT
Posted by: Carsten888 eng
Date: March 15, 2008 03:07AM

mysql_insert_id() returns 0 after a succesfull insert.

It worked fine when I defined the insert with:
$database->setQuery( "INSERT....
$database->query();
echo mysql_insert_id();
//returns the id

but when I made a var from $database in a class the insert works but the id is 0
$this->db->setQuery( "INSERT....
$this->db->query();
echo mysql_insert_id();
//returns 0

I tried these, but thats just plane wrong.
echo mysql_insert_id($database);
echo mysql_insert_id($this->db);
which gives error:
Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in....

anyone?

Options: ReplyQuote


Subject
Views
Written By
Posted
no mysql_insert_id() after $this->db->setQuery( "INSERT
6464
March 15, 2008 03:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.