MySQL UPDATE error to line 2 -
i have script:
include ('connect.php'); $data = mysql_query("select * projects id='2'") ; $da = mysql_fetch_array($data); if(isset($_post['submit'])){ $name = $_post['project_name']; $date = $_post['date']; $amount = $_post['amount']; $curr = $_post['curr']; $spec = $_post['spec']; $sql = "update projects set (name='$name', date='$date', amount='$amount', currency='$curr', specifications='$spec') id=2"; $res = mysql_query($sql); if($res) { echo "upadate successfull!"; } else { echo "sorry!"; echo mysql_error($connect)."<br />"; echo error_reporting(e_all)."<br />"; echo ini_set('desplay_errors','1'); }
note: connect.php file working ok since i've used before on other scripts on same server.
every time try submit form: sorry!you have error in sql syntax; check manual corresponds mysql server version right syntax use near '(name='sdadas', date='08/21/2013', amount='2444', currency='dollars', specificat' @ line 2 32767
what problem?
update .. set
syntax not use parenthesis:
update projects set name='myproject', date='08/21/2013', amount='2444', currency='dollars', specifications='none' id=2
Comments
Post a Comment