Forum Moderators: coopster

Message Too Old, No Replies

PHP MySQL - Works Once Then None

Writing to a MySQL database

         

Komodo_Tale

2:49 am on Jan 11, 2007 (gmt 0)

10+ Year Member



I wrote a write to table script(form->post->test->write). It works fine when the table is empty and generates the first row all fields okay. After that it will no longer write to the table. I get nothing....no success, no error statement, nothing.

I'm looking at the code, the table collumn names, the data types and I just do not see the error.

Any ideas what could cause such an issue?

Komodo_Tale

2:50 am on Jan 11, 2007 (gmt 0)

10+ Year Member



Here is the create table code:

CREATE TABLE user_info (
id_user_info INTEGER UNSIGNED NOT NULL,
user_name VARCHAR(14) NULL,
position VARCHAR(45) NULL,
member_type INTEGER NULL,
activated INTEGER NULL DEFAULT 0,
join_date INTEGER NULL,
birth_date INTEGER NULL,
wedding_date INTEGER NULL,
real_first_name VARCHAR(45) NULL,
real_last_name VARCHAR(45) NULL,
email VARCHAR(250) NULL,
show_email_to INTEGER NULL,
share_email INTEGER NULL,
aim VARCHAR(45) NULL,
google_talk VARCHAR(45) NULL,
icq VARCHAR(45) NULL,
msn_messenger VARCHAR(45) NULL,
yahoo_messenger VARCHAR(45) NULL,
windows_live_messenger VARCHAR(45) NULL,
show_im_to INTEGER NULL,
address_1 VARCHAR(100) NULL,
address_2 VARCHAR(100) NULL,
city VARCHAR(100) NULL,
postal_code VARCHAR(45) NULL,
state_province VARCHAR(2) NULL,
country VARCHAR(45) NULL,
share_mail INTEGER NULL,
security_code VARCHAR(16) NULL,
PRIMARY KEY(id_user_info)
);

Komodo_Tale

2:52 am on Jan 11, 2007 (gmt 0)

10+ Year Member



Here is the write to table query:

$sql="insert into user_info (
user_name,
position,
member_type,
activated,
join_date,
birth_date,
real_first_name,
real_last_name,
email,
show_email_to,
share_email,
show_im_to,
address_1,
city,
state_province,
postal_code,
country,
share_mail,
security_code
)
values (
\"$user_name\",
\"$position\",
\"$member_type\",
\"$activated\",
\"$join_date\",
\"$birth_date\",
\"$real_first_name\",
\"$real_last_name\",
\"$email_1\",
\"$show_email_to\",
\"$share_email\",
\"$show_im_to\",
\"$address_1\",
\"$city\",
\"$state_province\",
\"$postal_code\",
\"$country\",
\"$share_mail\",
\"$password_1\"
)" ;

Psychopsia

5:29 am on Jan 11, 2007 (gmt 0)

10+ Year Member



You need to set an auto_increment index for 'id_user_info' field.

The first time this field value save it as 0, and the next time again 0.

phranque

9:50 am on Jan 11, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



ALTER TABLE user_info CHANGE id_user_info
id_user_info INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
ADD INDEX (id_user_info);

Komodo_Tale

1:11 pm on Jan 11, 2007 (gmt 0)

10+ Year Member



Thank you. Wow do I feel stu...