php - I can not insert a value with apostrophe in the database -


i cant save value of select option: if value "t'est" cant save full string "t'est" in database.

if(isset($_post['ul'])){                 $festival_type = addslashes(mysql_escape_string($_post['tf']));     $query = mysql_query("insert festival (festival_name) values ('".$festival_type."')");                 echo "success!"; } 

warning: mysql_escape_string() extension deprecated of php 5.5.0, , removed in future. in case should use 1 escape rule.

if $_post['ul'] have word "t'est" , should save quote $festival_type have "t\'est" using addslashes. after mysql receive: insert festival (festival_name) values ('t\'est') means in database save t'est no problem.

if(isset($_post['ul'])){     $festival_type = addslashes($_post['tf']);     $query = mysql_query("insert festival (festival_name) values ('".$festival_type."')");                 echo "success!"; } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -