If you have the field set as auto_increment the you don't need to do
anything else. Let nature take it's course.  :)

try:
insert into player_table(player_name) values ('$player_name');

Cal
http://www.calevans.com


-----Original Message-----
From: Doug Linley [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 19, 2001 4:33 PM
To: [EMAIL PROTECTED]
Subject: auto_increment and last_insert_value()


I have a table that I created that has a primary key field that should be
auto_incremented.  To fill in this value I am calling

insert into player_table(playerid, player_name) values (LAST_INSERT_ID() +
1, '$player_name');

My problem is that I'm getting duplicated key values because last_insert_id
is always 0.  Anyone know what the problem might be?  The field is indexed
by the way.

Thanks in advance for your help!

Doug L.


---------------------------------------------------------------------
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