Jump to content

A New Error Message......AAAAAAGGGGGHHHHHH!!!!


Recommended Posts

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

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."

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?

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.