This query keeps failing with
Integrity constraint violation: 1048 Column 'login_name' cannot be null
My insert statement is...
$insertUserQuery = 'INSERT INTO `users` (
`login_name`,
`password`,
`first_name`,
`last_name`,
`company_name`,
`company_address`,
`country`,
`email`,
`phone_number`,
`agency_type`,
`sold_before`,
`authorised`,
`current_module`
)
VALUES (
:login_name, :login_password, :first_name, :last_name, :company_name, :company_address, :country, :email, :phone_number, :agency_type, :sold_before, 0, 0);';
$bindings = array(':login_name' => $loginName,
':login_password' => sha1($password . Config::PASSWORD_SALT),
':first_name' => $firstName,
':last_name' => $lastName,
':company_name' => $companyName,
':company_address' => $companyAddress,
':country' => $country,
':email' => $emailAddress,
':phone_number' => $phone,
':agency_type' => null,
':sold_before' => null
);
print_r($bindings);
Db::query($insertUserQuery, $bindings);
My Db class can be found here. The print_r() tells me that the array definitely has a value. I had some thoughts...
- May it have something to do with me using the word 'password' which is also a MySQL function?
- Does PDO support prepared statements with INSERT in the same fashion as it does with SELECT?
- Do I need to quote around the values, example ':login_name'
Thank you muchly