Jump to content

Error in php to sql


DrTrans

Recommended Posts

[code[

$queryreg = mysql_query("INSERT INTO application VALUES ('','$fname','$fname','$lname','$addy','$city','$state','$zip','$hphone','$wphone','$ssn','$dob','$aemail','$dl','$dlstate','$property','$employer','$eaddy','$ecity','$estate','$estate','$ezip','$supervisor','$empstartdate','$felony','$creditcard','$cardname','$cardaddress','$cardnum','$pets','$grossincome','$cardexp','$cvv','$cardinit','$fullname','$ref1','$ref1ph','$ref2','$ref2ph','$ssn2','$security','$date','$cphone','','','')") or die(mysql_error());

 

It dies everytime with th same error: "Column count doesn't match value count at row 1"

 

 

Link to comment
https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/
Share on other sites

$queryreg = mysql_query("INSERT INTO application (YOU MUST HAVE THE ROW NAMES HERE!) VALUES ('','$fname','$fname','$lname','$addy','$city','$state','$zip','$hphone','$wphone','$ssn','$dob','$aemail','$dl','$dlstate','$property','$employer','$eaddy','$ecity','$estate','$estate','$ezip','$supervisor','$empstartdate','$felony','$creditcard','$cardname','$cardaddress','$cardnum','$pets','$grossincome','$cardexp','$cvv','$cardinit','$fullname','$ref1','$ref1ph','$ref2','$ref2ph','$ssn2','$security','$date','$cphone','','','')") or die(mysql_error());

 

EG.

mysql_query("INSERT INTO `names` (`firstname`, `lastname`) VALUES('$firstname', '$lastname')");

 

James.

Link to comment
https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053570
Share on other sites

$queryreg = mysql_query("INSERT INTO application (`fname`,`lname`,`addy`,`city`,`state`,`zip`,`homephone`,`workphone`,`social`,`dob`,`appEmail`,`dlnumber`,`dlstate`,`property`,`employer`, `eaddy`, `ecity`, `estate`, `ezip`, `supervisor`, `estartdate`, `felony`, `creditcard`, `cardname`, `cardaddress`, `cardnum`, `pets`, `grossincome`, `cardexp`, `cvv`, `cardinit`, `fullname`, `ref1`, `ref1phone`, `ref2`, `ref2phone`, `ssn`, `security`, `date`) VALUES ('$fname','$lname','$addy','$city','$state','$zip','$hphone','$wphone','$ssn','$dob','$aemail','$dl','$dlstate','$property','$employer','$eaddy','$ecity','$estate','$estate','$ezip','$supervisor','$empstartdate','$felony','$creditcard','$cardname','$cardaddress','$cardnum','$pets','$grossincome','$cardexp','$cvv','$cardinit','$fullname','$ref1','$ref1ph','$ref2','$ref2ph','$ssn2','$security','$date')") or die(mysql_error());

 

Did that . still error:

Link to comment
https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053579
Share on other sites

For the first syntax (without a list of columns), you must supply a value for each column. If you got an error that the column count does not match, check your query to make sure you are supplying the correct number of values. Given that '$fname','$fname' is repeated, I would guess you need to correct the actual list of values.

 

What is the current error you are getting with the second syntax (where you supply a list of the columns you are supplying values for)?

Link to comment
https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053580
Share on other sites

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.