Tuesday 31 January 2017

php - Can't Save MySQL Query

I'm having an issue with my MySQL query/php, I try to update a row in my database that will work usually, but when the string has a ' in it, for example




I don't like green eggs and ham.





The ' in it will cancel the whole response out and not update the row, so if I put something like this without the ' for example:




I dont like green eggs and ham.




The string will save to the row. Below is the MySQL query used and where I get the string from.




$NewMessage = $_POST['message123'];

mysql_query("UPDATE Account SET `function` = 'Message', `note` = '$NewMessage' WHERE `id` = '$ID' AND `Online` = '1'");


If you need anymore source or anything, please let me know, let me know what you think, thanks!

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...