Re: Last Inserted ID Using LOAD DATA

2006-09-21 Thread Visolve DB Team
Hi, Your query was understood as - you want to retrieve the current value of the autoincrement column, where mysql_insert_id also reveals the same. Try either of this. Use LIMIT: select ID from tablename order by ID DESC LIMIT 1. or Use MAX() select MAX(ID) from tablename Thank

Re: [Fwd: Re: Last inserted ID]

2004-05-08 Thread Nathan Jones
On Wed, 2004-05-05 at 22:49, Paul DuBois wrote: > At 22:39 -0400 5/5/04, Nathan Jones wrote: > > > Hi there, > >> > >> I seem to be having a problem retrieving the last inserted ID for a > >> table. > >> > >> The query I am using is as follows: > >> > > > >It's far easier than anyone else has m

RE: Last inserted ID

2004-05-06 Thread Erich Beyrent
> Well, you don't need the distinct. > > Are you inserting with your PHP script? LAST_INSERT_ID(), as per the > > manual, > only returns the id from the last insert on that connect. You cannot get >the > LAST_INSERT_ID() for another connection. j- k- I used distinct because otherwise

Re: [Fwd: Re: Last inserted ID]

2004-05-05 Thread Paul DuBois
At 22:39 -0400 5/5/04, Nathan Jones wrote: > Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: It's far easier than anyone else has mentioned, as of my writing. Just use the PHP function 'mysql_insert_id()' after your inse

[Fwd: Re: Last inserted ID]

2004-05-05 Thread Nathan Jones
> Hi there, > > I seem to be having a problem retrieving the last inserted ID for a > table. > > The query I am using is as follows: > It's far easier than anyone else has mentioned, as of my writing. Just use the PHP function 'mysql_insert_id()' after your insert query. This function has bee

Re: Last inserted ID

2004-05-05 Thread Paul DuBois
At 20:34 -0500 5/5/04, Paul DuBois wrote: At 21:11 -0400 5/5/04, Erich Beyrent wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql> select distinct LAST_INSERT_ID() as LastID from listings; This can be simplified as

Re: Last inserted ID

2004-05-05 Thread Paul DuBois
At 21:11 -0400 5/5/04, Erich Beyrent wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql> select distinct LAST_INSERT_ID() as LastID from listings; This can be simplified as SELECT LAST_INSERT_ID as LastID; no need

Re: Last inserted ID

2004-05-05 Thread Daniel Kasak
Erich Beyrent wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql> select distinct LAST_INSERT_ID() as LastID from listings; ++ | LastID | ++ | 3575 | ++ 1 row in set (0.00 sec) Ho

Re: Last inserted ID

2004-05-05 Thread Joshua J. Kugler
Well, you don't need the distinct. Are you inserting with your PHP script? LAST_INSERT_ID(), as per the manual, only returns the id from the last insert on that connect. You cannot get the LAST_INSERT_ID() for another connection. j- k- On Wednesday 05 May 2004 05:11 pm, Erich Beyrent

Re: Last inserted id

2004-02-19 Thread Toro Hill
This will only be a problem if the two inserts are using the same mysql connection/link_indentifier. This isn't usually the case in a web environment, unless you are using a persistent mysql connection across multiple instances of the same script. mysql_insert_id() returns the last insert id for

Re: Last inserted id

2004-02-19 Thread Paul DuBois
At 9:33 + 2/19/04, Mark Maunder wrote: 'connection ID' below should be 'last insert id'. Sorry, it's 2am here and I'm fresh out of coffee. BTW the information you want is here: http://www.mysql.com/doc/en/Information_functions.html#IDX1409 "The last ID that was generated is maintained in the se

Re: Last inserted id

2004-02-19 Thread Binay
Thanks Mark... You popped me out of great confusion/problem. Binay - Original Message - From: "Mark Maunder" <[EMAIL PROTECTED]> To: "Binay" <[EMAIL PROTECTED]> Cc: "mysql users" <[EMAIL PROTECTED]> Sent: Thursday, February 19, 2004 3:03

Re: Last inserted id

2004-02-19 Thread Egor Egorov
"Binay" <[EMAIL PROTECTED]> wrote: > Hi > > I have a php script which insert a row in one of my table. Now i want the > auto_generated id produced by this insert query. I know i can use mysql_insert_id > function to fetch that auto_generated id. But my question is say two or more person > visit

Re: Last inserted id

2004-02-19 Thread Mark Maunder
'connection ID' below should be 'last insert id'. Sorry, it's 2am here and I'm fresh out of coffee. BTW the information you want is here: http://www.mysql.com/doc/en/Information_functions.html#IDX1409 "The last ID that was generated is maintained in the server on a per-connection basis. This means

Re: Last inserted id

2004-02-19 Thread Mark Maunder
The two simultaneous insert statements will be have separate connections to the database and last_insert_id() is connection specific. So if you're running apache, and you're worried about two different apache child processes getting the same connection ID, don't. Because those two children will hav