Hi, PHPLib is great but I want to get the primary ID/key after I have done an INSERT.
Thanks
I use $db->nextid() to create a new id and perform the insert specifying that as the key.
Only works if records are added only using the PHP script though. Otherwise your sequence and id's can get out of sync.
...R.
Is their anyother way to do this? as this is a BIG sticking point...
If you are using MySQL, add this function to your local.inc extension of DB_Sql.
function insert_id() { return @mysql_insert_id($this->Link_ID); }
Log in to post a comment.
Hi,
PHPLib is great but I want to get the primary ID/key after I have done an INSERT.
Thanks
I use $db->nextid() to create a new id and perform the insert specifying that as the key.
Only works if records are added only using the PHP script though. Otherwise your sequence and id's can get out of sync.
...R.
Is their anyother way to do this? as this is a BIG sticking point...
If you are using MySQL, add this function to your local.inc extension of DB_Sql.
function insert_id() {
return @mysql_insert_id($this->Link_ID);
}