10 messages in com.mysql.lists.win32FW: When should mysql_insertId return 0?| From | Sent On | Attachments |
|---|---|---|
| Januski, Ken | 20 Aug 2004 10:22 | |
| Petr Vileta | 20 Aug 2004 15:04 | |
| Januski, Ken | 20 Aug 2004 15:27 | |
| PF: MySQL | 20 Aug 2004 16:54 | |
| Petr Vileta | 20 Aug 2004 17:59 | |
| Januski, Ken | 20 Aug 2004 18:35 | |
| Paul DuBois | 20 Aug 2004 18:45 | |
| Januski, Ken | 20 Aug 2004 18:46 | |
| Januski, Ken | 20 Aug 2004 18:57 | |
| Petr Vileta | 21 Aug 2004 04:12 |
| Subject: | FW: When should mysql_insertId return 0?![]() |
|---|---|
| From: | Januski, Ken (kjan...@phillynews.com) |
| Date: | 08/20/2004 03:27:52 PM |
| List: | com.mysql.lists.win32 |
-----Original Message----- From: Januski, Ken Sent: Friday, August 20, 2004 6:11 PM To: 'Petr Vileta' Subject: RE: When should mysql_insertId return 0?
Petr,
Perhaps I'm misunderstanding you. It does work, for the nearly 500,000 or so records already in the database. What I can't figure out are those very rare exceptions, usually with a field value of 'xxxx\ ', that cause mysql_insertId to return 0. Are you suggesting that I use last_insert_id instead of mysql_insertId? Even if that also works I wonder if it would work with the type of insertion I just mentioned.
Thanks,
Ken
-----Original Message----- From: Petr Vileta [mailto:pe...@practisoft.cz] Sent: Friday, August 20, 2004 6:05 PM To: win...@lists.mysql.com Subject: Re: When should mysql_insertId return 0?
I'm wondering if someone can tell me when mysql_insertId should return 0.
I
Please try this:
create table mytest (id int(8) unsigned not null auto_increment, field varchar(20), primary key (id)); insert into mytest set field='HALLO'; select last_insert_id(); insert into mytest set field='BOY'; select last_insert_id();
This MUST work :-) And read MySQL documentation about "last_insert_id()" keyword.
Petr Vileta, Czech republic
-- MySQL Windows Mailing List For list archives: http://lists.mysql.com/win32 To unsubscribe: http://lists.mysql.com/win32?unsub=kjan...@phillynews.com




