Switch to: V11V10V9V8V7V6V5



long valentina_insert_id_of_table( string tblName, [string dbName], [resource link_identifier] )


Name Description
tblNameName of the table.
dbNameIf dbName is specified then table is seeking in that database.
link_identifierThe VServer connection. If the link identifier is not specified, the last link opened by valentina_connect() is assumed. If by chance no connection is found, an E_WARNING level warning is generated.


Retrieves the RecID of the last inserted query for specified table.

Return Values

The RecID value generated by the previous INSERT query on success, or FALSE in case of any error (for example - no connection established).


Example 1.

$link = valentina_connect('localhost', 'val_user', 'val_password');
if (!$link) {
   die('Could not connect: ' . valentina_error());
valentina_query("INSERT INTO mytable (product) values ('php')");
printf("Last inserted record has id %d\n", valentina_insert_id_of_table("mytable"));


Note: Because valentina_insert_id_of_table() acts on the last performed query, be sure to call valentina_insert_id_of_table() immediately after the query that generates the value.

See Also