Ok. Trying to add info to a mysql db and getting a simple error that's driving me crazy
Column count doesn't match value count at row 1
Here's the table
===========================================
$query = "CREATE table newsletterSurvey
(
ID SMALLINT(4) UNSIGNED NOT NULL AUTO_INCREMENT,
learn TEXT,
frequency TEXT,
length TEXT,
format TEXT,
click TEXT,
interest TEXT,
content_area TEXT,
topics TEXT,
degree TEXT,
classYear TEXT,
school TEXT,
age TEXT,
occupation TEXT,
comments TEXT,
date DATE,
PRIMARY KEY(ID)
)" or die (mysql_error());
$results = mysql_db_query($dbName, $query, $connection);
===============================================
Here is the INSERT statement
$query = "INSERT INTO newsletterSurvey VALUES ( '0',
'".$learn."',
'".$frequency."',
'".$length."',
'".$format."',
'".$click."',
'".$interest."',
'".$content_area."',
'".$topics."',
'".$degree."',
'".$classYear."',
'".$school."'
'".$age."',
'".$occupation."',
'".$comments."'
'".$date."')";
$result = mysql_query($query, $connection) or die(mysql_error());
Any idea??
Tks.
php/mysql error
Moderator: General Moderators
quotes man quotes
You are using far to many " a
try this
I found what you problem was you missing a couple of comma's at the end of '".$school."' and '".$comments."' which would cause the sql to fail and think that there is less lines than there actually is.
phpScott
try this
Code: Select all
$query = "INSERT INTO newsletterSurvey VALUES ( '0',
'$learn',
'$frequency',
'$length',
'$format',
'$click',
'$interest',
'$content_area',
'$topics',
'$degree',
'$classYear',
'$school',
'$age',
'$occupation',
'$comments',
'$date')";phpScott