Hi everyone,
I am pulling data from MySQL and placing it into form fields for the user to update. If there are apostrophe's in any of the field's, except the description field, I get a DB Error: Syntax error. I thought using a place holder would eliminate this and it does for description, but not for anything else. If I put a "\" in front of the apostrophe's everything works. Any ideas?
Thanks!
Here is my code:
$isbn = $_POST['isbn'];
$artist_name = htmlentities($_POST['artist_name']);
$album_title = $_POST['album_title'];
$album_title = $_POST['album_title'];
$release_date = $_POST['release_date'];
$description = nl2br(htmlentities($_POST['description']));
$price = $_POST['price'];
$sql_update = "UPDATE lounge SET artist_name = ?, album_title='$album_title', release_date='$release_date', add_date='$add_date', description = ?, price='$price' WHERE isbn = $isbn";
$db->query($sql_update, array($artist_name, $description));