Correcting an UPDATE statement (and making it more secure!)
- by Jess
I'm trying to a single value in my DB...When I run it through the console, it works correctly (as I'm replacing the variables with numbers and text).. However, My query is not running correctly. It's just prompting a syntax error Here is what I have:
"UPDATE books SET readstatus='".$readstatus."' WHERE book_id=".$book_id;
This won't work, I also tried doing something like this as I'm told this makes it a bit more secure? :
"UPDATE books SET readstatus='{$readstatus}', WHERE read_id='{read_id}'";
This does not prompt any errors, but no change is happeneing to the value in the DB, I'm guessing the syntax is incorrect.