DrTrans Posted May 5, 2010 Share Posted May 5, 2010 [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" Quote Link to comment https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/ Share on other sites More sharing options...
jamesxg1 Posted May 5, 2010 Share Posted May 5, 2010 $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. Quote Link to comment https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053570 Share on other sites More sharing options...
DrTrans Posted May 5, 2010 Author Share Posted May 5, 2010 $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: Quote Link to comment https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053579 Share on other sites More sharing options...
PFMaBiSmAd Posted May 5, 2010 Share Posted May 5, 2010 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)? Quote Link to comment https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053580 Share on other sites More sharing options...
DrTrans Posted May 5, 2010 Author Share Posted May 5, 2010 same error and I corrected the double "$fname" in the last post. Quote Link to comment https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053581 Share on other sites More sharing options...
PFMaBiSmAd Posted May 5, 2010 Share Posted May 5, 2010 You have a double - '$estate','$estate' Quote Link to comment https://forums.phpfreaks.com/topic/200788-error-in-php-to-sql/#findComment-1053582 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.