I want to use the autogenerated primary key of a INSERT statement to use in another insert statement for another table.
I am using SQLite in PHP.
Here is the code example:
PHP Code:
$result = sqlite_exec ($db_resource, 'INSERT INTO mytable (field1, field2, field3)
VALUES (\'something\', \'something\', \'something\');');
I want the autoincremented primary key of this insertion for use in another query, but I don't want to use SELECT, because it might yield a wrong answer. Supposing another insertion has taken place before I call select, I might get the wrong row.
Any help will be appreciated.