Forum Moderators: coopster

Message Too Old, No Replies

"column count doesn't match value count at row 1"

My columns add up though ! :S! :(

         

marsters2256

1:15 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



Here's the code that gives the error "column count doesn't match value count at row 1"
#############

require_once ('..\dbc\dbc.php');
$query = "INSERT INTO users
( autoID, user_name, first_name, last_name, age, email, password )
VALUES
( '', 'mars', 'Benji' 'wall', 21, 'will@example.com', SHA('f00') )";

###############
Here's the code i created the table with in MYSQL
###############
create table users (autoID int unsigned auto_increment primary key, user_name varchar(20), first_name varchar(20), last_name varchar(20), age int, email varchar(40), password varchar(20));

###############
Curious thing - when i typed the exact same code out in mysql by hand it worked - but copy and pasting the same code doesn't.

What's going on someone please help me...

[edited by: eelixduppy at 1:18 pm (utc) on Feb. 5, 2008]
[edit reason] example.com [/edit]

marsters2256

1:23 pm on Feb 5, 2008 (gmt 0)

10+ Year Member



I just sorted it out -

$query = "INSERT INTO users
( autoID, user_name, first_name, last_name, age, email, password )
VALUES
( '', 'mars', 'Benji' 'wall', 21, 'will@example.com', SHA('f00') )";

notice the lack of a comma between my first and second names.

Man its pedantic!

well I guess I'll work on validating my forms now!

( oh god... )

jatar_k

1:23 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hehe, nice work, good luck on the forms ;)