php - semi-colon breaking mysql_query -
this question has answer here:
- how can prevent sql injection in php? 28 answers
i'm adding html code database through mysql_query. so, basic query looks $qry = "update pages set ".$column."='$value' id='$id'";
if called, actual query might this: $qry = "update pages set content_en='<h1>this title</h1>' id='12'";
however, if html code looks this: <h1 style='color:red;'>this title</h1>
, it'll break query because of semi-colon. there way solve this?
use mysql escaping function on content, :
$value = mysqli_real_escape_string($value);
Comments
Post a Comment