php - Save html on database and titles with quotes -


this question has answer here:

if try save text on db i'm getting error.

lets this:

$name = "bob's pizzaria"; $description = "<b>tes, test</b>"; // color, size formats 

when save database use this:

$a_name = mysql_real_escape_string($_request["name"]); $a_desc = mysql_real_escape_string($_request["description"]); 

then insert database.

i error on $a_name because there apostrophe ( ' )

and on description doesn't retain text format bold, color, size etc.

what best or right way this?

replace ' '

str_replace("'","&apos;",$name); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -