Posted by Gordon Burditt on 10/01/05 20:36
>I am trying to get the value of the Auto-Incremented key that was assigned
>using LAST_INSERT_ID(). However, when I execute the following PHP statements
>after the insert I only get: "value of entryID: Resource id #7" after EVERY
>insert (it never changes).
The return value of mysql_query is *NOT* the value for last_insert_id().
Fetch a row (e.g. using mysql_fetch_row) and then look at the column
you want, and *thats* the value you are looking for.
>..............................
>$_SESSION["entryID"] = (mysql_query ('SELECT LAST_INSERT_ID() FROM
>tblShowEntries'));
>
>$entryID = $_SESSION["entryID"];
>echo "value of entryID: $entryID";
Gordon L. Burditt
[Back to original message]
|