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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -