On Friday 21 June 2002 06:55, Arul wrote:

No, but last_insert_id() is only valid until you do another query on the same 
database handle. The only explanation I can think of is that somehow you're 
code is interjecting some other query between the insert and the call to 
last_insert_id(). Maybe a commit? I'd make sure that the very next thing you 
do after insert is to get that id. 

> Even the last_insert_id() returns 0
> is it coz the table type is INNODB
>
>
> ----- Original Message -----
> From: "Jan Peuker" <[EMAIL PROTECTED]>
> To: "Arul" <[EMAIL PROTECTED]>
> Sent: Friday, June 21, 2002 4:16 PM
> Subject: Re: @@IDENTITY
>
> > You are using M$-Syntax, in MySQL you should use:
> > SELECT last_insert_id()
> > http://www.mysql.com/doc/e/x/example-AUTO_INCREMENT.html
> >
> > regards,
> >
> > jan
> >
> >
> > ----- Original Message -----
> > From: Arul
> > To: MySQL
> > Sent: Friday, June 21, 2002 12:17 PM
> > Subject: @@IDENTITY
> >
> >
> >    Hi
> >
> > I m using mysql 3.23.51 on win 2k
> >
> > Well..I have a user table where i have the userid column as primary key
>
> and
>
> > auto_increment column and name as varchar(25).
> >
> > I insert values in the table such as
> >
> > Insert into user (name) values ('AA');
> >
> > Then When i do select @@Identity in the next time , it tells me as 0
> >
> > Why is this happenning..
> >
> > I need to get the last inserted value of the primary key ..right
> >
> > -Arul
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]> Trouble
> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to