InnoDB "Column count doesn't match value count at row 1"
- by Webnet
I'm having issues with a table. I'm using the following to create my insert query...
$validatedData = array();
foreach ($post as $key => $value) {
if ($key != 'submit' && $key != 'dz_tos' && $key != 'dz_billShip') {
$validatedData[$key] = filter_var($value, FILTER_SANITIZE_STRING);
}
}
mysql_query("INSERT INTO dz_users(".implode(array_keys($validatedData), ',').", dz_access_level) VALUES(\"".implode($validatedData, '\",\"')."\", 1)");
So every column has a value to match it. The problem is that I'm getting the SQL error:
Column count doesn’t match value count at row 1
The database is an innoDB and all columns are varChar/Char except for the ID field which is an auto increment primary key.