|
Posted by George on 09/11/06 18:43
On 11 Sep 2006 08:01:34 -0700, NC wrote...
>
>Pugi! wrote:
>>
>> In a mysql database you have a table, with an integer
>> as primary key. You've specified auto_increment.
>> Using PEAR to access your database how do you
>> get hold of the value of the primary key of a row you
>> just inserted ?
>
>Call mysql_insert_id():
>
>http://www.php.net/mysql_insert_id
>
>Cheers,
>NC
>
Thanks for the information. I wasn't sure if that would work on older versions
of MySQL since the mysql_insert_id function in MySQL wasn't added until v4.1.2.
Wasn't sure if PHP used mysql_insert_id or last_insert_id with its function. If
it does create a problem, I think you can run a query with a statement like
this...
"SELECT LAST_INSERT_ID()"
George
--
Help a community by participating in ours!
NewsGuy.Com - http://newsguy.com/charity.asp
Navigation:
[Reply to this message]
|