Hi there!
I was wondering how I could insert quotation marks (") to a mysql db. I want to insert some html codes (<a href="lol.html" target"_blank">lol</a>).
Thanks for any help
How to insert quotation marks to a mysql db?
Moderator: General Moderators
Re: How to insert quotation marks to a mysql db?
Use the escape (backslash) character.
Re: How to insert quotation marks to a mysql db?
Code: Select all
$about = str_replace('"', '\"', nl2br($_POST['about']));
mysql_query("INSERT INTO xxx (about) VALUES ('$about')");You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bla bla bla bla blab al' at line 1
Re: How to insert quotation marks to a mysql db?
Use mysl_real_escape_string()
There are 10 types of people in this world, those who understand binary and those who don't
Re: How to insert quotation marks to a mysql db?
Sorry guys, I was too fast with the c/p so there was two quotes in stead of one. :-p