MySQL function problem

wxdqz

New Member
I am having problems trying to get the auto-incremented id of a record after an insert onto a MySQL table. The auto-incremented field is the primary key, and is not referenced in the insert statement below.

Running the following simple code:

$sql = "INSERT INTO persbook (membname, seq, parent, open, title) VALUES ('$member', '0', '0', 'N', '$title')";
$result = mysql_query($sql);
$holdid = mysql_insert_id($result);

Gets the following error response:

Warning: Supplied argument is not a valid MySQL-Link resource in [directory path...]on line 15
---line 15 is the one with mysql_insert_id

When I substitute last_insert_id for mysql_insert_id, I get:
Fatal error: Call to undefined function: last_insert_id() in [etc...]

The insert to the database DOES work.

What can be wrong?
 
Back
Top