For some time I struggled with a small problem. He was there for years, but it was just an annoying problem, not a serious one, and I just worked on it. But now I want to find out if anyone can help me. I did some google'ing, but did not have time.
If I make a form post from html textarea in a php file, for example:
<form action="http://action.com" method="post"> <textarea name="text"><a href="http://google.com">google site</a></textarea> </form>
and of course there is a submit button, etc.
The value is a problem: <a href="http://google.com">google site</a> The value of the text field has both "(quote mark) and" (apostrophe).
To save this in mysql_database, I do this:
$result = mysql_query("INSERT INTO `table` (`row1`) VALUES ('".$_POST['text']."') ") or die(mysql_error());
And now I get mysql error:
You have an error in the SQL syntax; check the manual that matches the version of your MySQL server for the correct syntax to use next to the site '' on line 1
sql php mysql apostrophe
Daniel Rufus Kaldheim
source share