If playerid is an auto_increment field, then either of these work --

INSERT INTO player_table(player_name) VALUES ('$player_name');
INSERT INTO player_table(playerid, player_name) VALUES
(NULL,'$player_name');



"Doug Linley" <[EMAIL PROTECTED]> wrote:

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

Reply via email to