PHP Code:
$value = "john's name is John Smith";
mysql_query("insert into tbltest set name='$value'") or die(mysql_error());
the code above causes SQL error while the code below successfully inserts the value to DB.
PHP Code:
$value = mysql_real_escape_string("john's name is John Smith");
mysql_query("insert into tbltest set name='$value'") or die(mysql_error());
mysql_real_escape_string() is cool.
it can insert apostrophe and prevent the opening tag "<" and closing tag ">".
I guess I should do it to every user-submit data.
Bookmarks