Is there a good practice to update a MySQL database with PHP? Should I use this code:
function change_email($email, $email_new) {
$sql = "UPDATE users SET email = '$email_new' WHERE email = '$email' LIMIT 1";
$this->_db->query($sql);
}
Or is there a better solution? I heard of prepared statements and I think I should better use them here because $email and $email_new are user inputs.
Thank you very much.