mysql_insert_id([resource link_identifier]) returns the value of the
auto_increment field for the previous INSERT query. It will return 0 if
there is not an auto_increment field. If the link_identifier is not
specified, the last opened connection is used.
So, use $id = mysql_insert_id();
Is there a similar function for a Sybase - Database ?
-Original Message-
From: Ian Grant [SMTP:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 12:20
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] getting ID
mysql_insert_id([resource link_identifier]) returns the value
:
@drkw.comSubject: RE: [PHP-DB] getting ID
Yap ... this works quite fine with Sybase
Thank you very much ...
-Original Message-
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 12:27
To: Walter, Marcel
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] getting ID
With MSSQL I do
Just a little addition...
I use this function to get the id value, given a field name, field data and
table name:
function getId($fname,$data,$tblName) {
GLOBAL $conn;
$query = SELECT id FROM $tblName WHERE $fname = '$data';
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$id =
At 19:19 8/19/2001, CrossWalkCentral wrote the following:
--
I have a script where I submit user data to the database in my script I need
to get the id # how can I do this w/o creating a query that does the
following considering that