![]() |
|
|
|||||||
| Database Integration How to use MySql, PostgreSQL, MS SQL, Oracle, and most other databases with PHP. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
function Button5Click($sender, $params)
{ $sql2 = "insert into customers (billaddress_firstname) VALUES ('newone')"; $this->Database1->Execute($sql2); echo "ID of last inserted record is: " . mysql_insert_id(); } I have similar code in another app (different database) and the id is returned correctly. customers table has field 'cid set to auto inc and key field. Any ideas please? |
| Sponsored Links |
|
|
|
|||
|
I have 2 datasources in the app. If I remove the one not related to the customer table the ID works fine.
So I presume I need a command to say: echo "ID of last inserted record is: " . mysql_insert_id() from (DATASOURCE1); How do I do this please? |
|
||||
|
A look in the manual
PHP: mysql_insert_id - Manual says: int mysql_insert_id ([ resource $link_identifier ] ) |
|
|||
|
echo "ID of last inserted record is: " . mysql_insert_id($this->Database2->_connection);
fails error: Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in Anyone know the correct syntax please? |