Greetinsg.
If I have a table like with a column being the PK for the table and being an
Auto Increment value, what is the best way to return this value to my
script? It is possible that additional rows may have been added during the
small wait.
Ie.
Col 1 Col 2 Col 3
Hi,
I imagine there has to be a better way!
Yes :) Take a look at the LAST_INSERT_ID() function.
Take care,
Aleksandar
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
]
net Subject: Re: Best way to get value of
autoincriment after inserting NULL?
12/15/2003 01:13
On Mon, 15 Dec 2003, Paul Fine wrote:
If I have a table like with a column being the PK for the table and being an
Auto Increment value, what is the best way to return this value to my
script?
If you insert a row LAST_INSERT_ID() will return the primary key value in
this setup.
The other way
, December 15, 2003 12:56 PM
To: Paul Fine
Cc: [EMAIL PROTECTED]
Subject: Re: Best way to get value of autoincriment after inserting NULL?
On Mon, 15 Dec 2003, Paul Fine wrote:
If I have a table like with a column being the PK for the table and being
an
Auto Increment value, what is the best way
-
From: Tobias Asplund [mailto:[EMAIL PROTECTED]
Sent: Monday, December 15, 2003 12:56 PM
To: Paul Fine
Cc: [EMAIL PROTECTED]
Subject: Re: Best way to get value of autoincriment after inserting NULL?
On Mon, 15 Dec 2003, Paul Fine wrote:
If I have a table like with a column being
select last_insert_id();
or in php use the mysql_insert_id() eg:
$somevalue = mysql_insert_id();
print (The last auto incremented number was: $somevaluebr\n);
Cheers
Curtis
Paul Fine said:
Greetinsg.
If I have a table like with a column being the PK for the table and
being an Auto