Jump to content

Column count doesn't match value count at row 1


blink359

Recommended Posts

I have made a script to put an account into a database but whenever i try to create the account i get:Column count doesn't match value count at row 1

I cannot find a problem myself and therefore i have come to ask you guys if you can see it this is my database structure from an export:

CREATE TABLE `users` (
  `f_name` varchar(20) collate latin1_general_ci NOT NULL,
  `l_name` varchar(20) collate latin1_general_ci NOT NULL,
  `user` varchar(20) collate latin1_general_ci NOT NULL,
  `password` varchar(20) collate latin1_general_ci NOT NULL,
  `email` varchar(35) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`user`)

 

Here is my mysql query in the php script

 

mysql_query("INSERT INTO users   (`f_name`, `l_name`, `user`,`password`,`email`) VALUES('$firstname', '$lasttname', '$username', '$password' '$email')") 
or die(mysql_error());  

$query_insert = mysql_query("INSERT INTO users  (f_name, l_name, user,password,email)  VALUES('$firstname', '$lastname', '$username', '$password', '$email')");
if(!$query_insert) mysql_error();  

 

If the table exists with those titles this should work

 

(you don't need the back ticks and the variable $lastname was $lasttname and there was a comma missing between email and password)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.