php - MySQL - Build a query string -


i've tried of below yet can't seem working

$sql="update filename set weekday = {$_get[wkd]} id = 2";     $sql="update filename set weekday = '$_get[wkd]' id = 2";     $sql="update filename set weekday = '"{$_get[wkd]}"' id = 2";     $sql="update filename set weekday = '."{$_get[wkd]}".' id = 2"; 

what correct way?
thanks

the proper way? assuming $link mysqli_connect

$wkd = mysqli_real_escape_string($link, $_get['wkd']);  $sql = "update filename set weekday = '" . $wkd . "' id = 2"; 

http://de1.php.net/manual/en/mysqli.real-escape-string.php


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -