This topic is locked
[SOLVED]

 Duplicate entry '1' for key 1

11/23/2009 4:58:36 AM
PHPRunner General questions
M
maali author

Hi all
I have create a member table and used PHPRunner to create member_list.php and member_add.php! But I get this error each time I try to create a new record! "Duplicate entry '1' for key 1" using the member_add.php!!
my table is created in this way:
CREATE TABLE members(

id int(11) unsigned auto_increment,

name varchar(150),

passwd varchar(255),

email varchar(255),

activation int(1),

datetime datetime,

last_login datetime,

gender varchar(10),

description longtext,

city varchar(32),

country varchar(255),

married varchar(255),

homepage varchar(255),

online varchar(3),

birthdate datetime,

updated datetime,

image varchar(255),

status varchar(25),

groupid varchar(25),

counter int(6),

rated int(6),

PRIMARY KEY (id)

) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Can anyone help please?
BR

Maali

D
danaci 11/23/2009

previously entered data table is not empty.

auto_increment value for your table as records or upgrade your table or empty
alter table member auto_increment=your record count

M
maali author 11/23/2009



previously entered data table is not empty.

auto_increment value for your table as records or upgrade your table or empty
alter table member auto_increment=your record count


Hi
As you se, I have already auto_increment!
CREATE TABLE members(

id int(11) unsigned auto_increment,

name varchar(150),

passwd varchar(255),

email varchar(255),

activation int(1),

datetime datetime,

last_login datetime,

gender varchar(10),

description longtext,

city varchar(32),

country varchar(255),

married varchar(255),

homepage varchar(255),

online varchar(3),

birthdate datetime,

updated datetime,

image varchar(255),

status varchar(25),

groupid varchar(25),

counter int(6),

rated int(6),

PRIMARY KEY (id)

) ENGINE=MyISAM DEFAULT CHARSET=utf8;
I am not sure what you mean.

Can you set the parameter here?
id int(11) unsigned auto_increment,
BR

Maali

M
maali author 11/23/2009



previously entered data table is not empty.

auto_increment value for your table as records or upgrade your table or empty
alter table member auto_increment=your record count


Hi
is this the solution?
ALTER TABLE members AUTO_INCREMENT=10;
BR

Maali

D
danaci 11/23/2009

yes?

M
maali author 11/23/2009



yes?


the mysql auto_incriment counts OK. The members_add.php for some reason dose not get the ID and gets the same ID which creates the record!!

M
maali author 11/23/2009



Hi all
I have create a member table and used PHPRunner to create member_list.php and member_add.php! But I get this error each time I try to create a new record! "Duplicate entry '1' for key 1" using the member_add.php!!
my table is created in this way:
CREATE TABLE members(

id int(11) unsigned auto_increment,

name varchar(150),

passwd varchar(255),

email varchar(255),

activation int(1),

datetime datetime,

last_login datetime,

gender varchar(10),

description longtext,

city varchar(32),

country varchar(255),

married varchar(255),

homepage varchar(255),

online varchar(3),

birthdate datetime,

updated datetime,

image varchar(255),

status varchar(25),

groupid varchar(25),

counter int(6),

rated int(6),

PRIMARY KEY (id)

) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Can anyone help please?
BR

Maali


disabling this in the members_add.php fixed the problem.

$avalues["id"]=prepare_for_db("id",$SESSION["".$strTableName."_OwnerID"]);