MySQLi Update data in a table -
please me out this. update existing table (chem_users) data using 2 keys userid & password (or 1 primary key allowed?). using mysqli, wrong syntax.
$sql = "update chem_users set (prj1, prj2) values ('{$_post['kinetics']}', '{$_post['thermo']}') (userid=johnking password=1234rewq)";
i got error: error saving user data have error in sql syntax; check manual corresponds mysql server version right syntax use near '(prj1, prj2) values ('kinetics' @ line 1
try using syntax:
$sql="update `chem_users` set `prj1`=".$_post['kinetics'].",`prj2`=".$_post['thermo']." `userid`='johnking' , `password`='1234rewq'";
by way, shouldn't concatenate variable inside query doing,you should use prepared statements.you can learn little bit in link: http://www.w3schools.com/php/php_mysql_prepared_statements.asp
Comments
Post a Comment