[UPHPU] returning MySQL
David Smith
DavidSmith at byu.net
Tue Feb 22 16:49:15 MST 2005
<quote who="Timothy Humphrey">
> 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',
> '$var_3')";
> $result = $db->query($record);
> $db->commit();
> ?>
>
> I would want to create another variable for the auto increment number
> that the database assigned to that new entry.
Use mysql_insert_id():
http://php.net/mysql_insert_id
--Dave
More information about the UPHPU
mailing list