[UPHPU] returning MySQL
Brady Mitchell
mydarb at comcast.net
Tue Feb 22 16:57:22 MST 2005
Depending on the DB class you are using, it might have a function for this built in. I know that
ADODB (http://adodb.sf.net) does. Otherwise, use the mysql_insert_id() function that Dave
mentioned.
Brady
-----Original Message-----
From: uphpu-bounces at uphpu.org [mailto:uphpu-bounces at uphpu.org] On Behalf Of Timothy Humphrey
Sent: Tuesday, February 22, 2005 4:38 PM
To: uphpu at uphpu.org
Subject: [UPHPU] returning MySQL
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.
Hope that makes since.
Timothy
_______________________________________________
UPHPU mailing list
UPHPU at uphpu.org
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net
More information about the UPHPU
mailing list