php - What is wrong with my update cade? -
what wrong code update sql database table informatie , need update field text.
$info = nl2br($_post["info"]); echo $info."<br>"; $infoid = $_post["infoid"]; echo $infoid; echo "<br>info id : $infoid"; $sql = "update informatie set text = $text infoid = $infoid"; $query = mysql_query("$sql");
the echo $info , $infoid correct.
i tryd
$sql = "update informatie set text = $text infoid = '$infoid'";
also didnt work to
string values must quoted.
$sql = "update informatie set text = '$text' infoid = $infoid";
if infoid
string, need wrap single quotes.
$sql = "update informatie set text = '$text' infoid = '$infoid'";
as sidenote, query vulnerable sql injection
if value(s) of variables came outside. please take @ article below larn how prevent it. using preparedstatements
can rid of using single quotes around values.
php mysql sql sql-update
No comments:
Post a Comment