[UPHPU] returning MySQL
DavidSmith at byu.net
Tue Feb 22 21:52:03 MST 2005
This may be the case, though no users have posted comments about it on the
manual page, which makes me think the function is safe in that regard. I
personally have never had a problem using mysql_insert_id(), even when
using mysql_pconnect(). If, however, that doesn't work for you, you can
always use the built-in function LAST_INSERT_ID() in your SQL query, as
<quote who="Grant Shipley">
> Someone correct me if I am wrong here but that will only return the
> last insert id for that connection. So if you have some type of
> connection pooling or caching system in place, you might not get the
> number you are expecting.
> On Tue, 22 Feb 2005 16:37:53 -0700, Timothy Humphrey
> <timothy.humphrey at gmail.com> wrote:
>> How would one return the "auto increment" number from a newly created
>> record automatically?
>> For example:
>> $record = "INSERT INTO database VALUES ('', '$var_1','$var_2', '1',
>> $result = $db->query($record);
>> I would want to create another variable for the auto increment number
>> that the database assigned to that new entry.
>> Hope that makes since.
More information about the UPHPU