JayCee Posted January 5, 2010 Share Posted January 5, 2010 It's been a long day......Does anyone have an idea what this error message means? I have no idea?? Column count doesn't match value count at row 1 I have an HTML form, when I click submit it goes to the following code: <?php $House = $_POST['HOuse']; $Name = $_POST['FName']; $Surname = $_POST['LName']; $Comment = $_POST['Comment']; $PName = $_POST['PFname']; $PSurname = $_POST['PLname']; $Year = $_POST['Year']; $Contact = $_POST['Contact']; mysql_connect ("localhost","USERNAME","PASSWORD") or die ('Error: ' . mysql_error()); mysql_select_db ("DBNAME"); $query="INSERT INTO HOH (House, Name, Surname, Query, Pupil_Name, Pupil_Surname, Year, Contact_No)VALUES ('".$House."','".$Name."','".$Surname."','".$Comment."''".$PName."','".$PSurname."','".$Year."','".$Contact."')"; mysql_query($query) or die (mysql_error()); ECHO "<meta http-equiv=\"refresh\" content=\"3; url=">"; ?> Thanks, JayCee Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/ Share on other sites More sharing options...
premiso Posted January 5, 2010 Share Posted January 5, 2010 It means you have 1 too many or 1 few columns in your mysql query: $query="INSERT INTO HOH (House, Name, Surname, Query, Pupil_Name, Pupil_Surname, Year, Contact_No)VALUES ('".$House."','".$Name."','".$Surname."','".$Comment."','".$PName."','".$PSurname."','".$Year."','".$Contact."')"; You were missing a comma between: '".$Comment."''".$PName." Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/#findComment-988994 Share on other sites More sharing options...
JayCee Posted January 5, 2010 Author Share Posted January 5, 2010 Hi Yeah, I thought it might be that as I had an additional field in my table in order to record a Date/Time Stamp automatically upon entry. However, I have removed that field so now have the same number of fields in my table as I do in my coding. Any other ideas? Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/#findComment-989001 Share on other sites More sharing options...
RaythMistwalker Posted January 5, 2010 Share Posted January 5, 2010 did you fix the missing comma? Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/#findComment-989006 Share on other sites More sharing options...
PFMaBiSmAd Posted January 5, 2010 Share Posted January 5, 2010 The error has to do with a different number of columns listed in the query (which can be different from the number of actual columns in your table) and a different number of data values supplied in the query. Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/#findComment-989009 Share on other sites More sharing options...
premiso Posted January 5, 2010 Share Posted January 5, 2010 Any other ideas? Yea, my original idea: You are missing a comma between: '".$Comment."''".$PName." Did you even replace your INSERT INTO statement with the correct one I posted, if not here is what the above should look like: '".$Comment."','".$PName." Note the comma separating those two items. That needs to be there to signify 2 separate fields, as that is what they are. Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/#findComment-989011 Share on other sites More sharing options...
JayCee Posted January 5, 2010 Author Share Posted January 5, 2010 I missed a comma out, sorry to waste your time!!! Like I said, Long Day!!! Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/#findComment-989034 Share on other sites More sharing options...
JayCee Posted January 5, 2010 Author Share Posted January 5, 2010 I just read your replies, Yeah realised I missed the comma and then felt like an idiot!!! Just didn't pick it up despite reading and re-reading and re-reading!!! Link to comment https://forums.phpfreaks.com/topic/187280-a-new-error-messageaaaaaaggggghhhhhh/#findComment-989037 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.