I am trying to insert a row into a database, I am properly connected to the database with select, insert, delete, and update permissions. I know because this was a previous problem that I fixed. this is my code:
$query = "INSERT INTO 'user_account'
('user_account_id', 'user_type_id', 'email', 'password', 'date_of_birth', 'gender',
'is_active', 'contact_number', 'sms_notification_active',
'email_notification_active', 'user_image', 'registration_date')
VALUES
(:user_account_id, :user_type_id, :email, :password, :date_of_birth,
:gender, :is_active, :contact_number, :sms_notification_active,
:email_notification_active, :user_image, :registration_date)";
$statement = $db->prepare($query);
$statement->bindValue(':user_account_id', '1');
$statement->bindValue(':user_account_id', '1');
$statement->bindValue(':user_type_id', '1');
$statement->bindValue(':email', 'rd@msn.com');
$statement->bindValue(':password', '2Twinboys');
$statement->bindValue(':date_of_birth', '03/24/1992');
$statement->bindValue(':gender', 'M');
$statement->bindValue(':is_active', 'Y');
$statement->bindValue(':contact_number', '8164529832');
$statement->bindValue(':sms_notification_active', 'N');
$statement->bindValue(':email_notification_active', 'Y');
$statement->bindValue(':user_image', file_get_contents('id_image.jpg'));
$statement->bindValue(':registration_date', '10/25/2020');
if($statement->execute() === true) {
$msg = "New account created successfully";
} else {
$msg = "Error: " . $query . "<br>";
}
$statement->closeCursor();
then in my html I have:
<p><?php echo $msg; ?></p>
and the output is:
Error: INSERT INTO 'user_account' ('user_account_id', 'user_type_id', 'email', 'password', 'date_of_birth', 'gender', 'is_active', 'contact_number', 'sms_notification_active', 'email_notification_active', 'user_image', 'registration_date') VALUES (:user_account_id, :user_type_id, :email, :password, :date_of_birth, :gender, :is_active, :contact_number, :sms_notification_active, :email_notification_active, :user_image, :registration_date)
so can someone tell me why my insert never works?