I am getting this error:
An error occured: Database error. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@gmail.com,
salt
= ,iteration
= 12,method
= blowfish,person_id
' at line 1
Here is the code:
$data_con = new data_abstraction;
$data_con->execute_query("INSERT into `USER` SET `username` = $user, `password` = $phsh, `email` = $email, `salt` = $salt, `iteration` = $new_iteration, `method` = $new_method, `person_id` = $result2, `role_id` = $result4, `skin_id` = $result5");
Edit:
I already used prepared the query, used parameterized statements and bind the parameters. The error has gone but the details I want to be inserted into the table are not added.
Here is my code:
if(!($sql = $link->prepare("INSERT into `USER` SET
`username` = ?,
`password` = ?,
`email` = ?,
`salt` = ?,
`iteration` = ?,
`method` = ?,
`person_id` = ?,
`role_id` = ?,
`skin_id` = ?"))){
echo "SQL Query Preparation has failed";
}
if(!($sql->bind_param("ssssisiii", $user, $phsh, $email, $new_salt, $new_iteration, $new_method, $result2, $result4, $result5))){
echo "Parameter Binding failed";
}
if(!($sql->execute())){
echo "MySQL Query Execution has failed";
}