InnoDB "Column count doesn't match value count at row 1"

Posted by Webnet on Stack Overflow See other posts from Stack Overflow or by Webnet
Published on 2010-03-18T16:28:04Z Indexed on 2010/03/18 16:31 UTC
Read the original article Hit count: 386

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about sql