Thursday, 15 January 2015

PHP MySQL Query Syntax Error? -



PHP MySQL Query Syntax Error? -

i think i'm doing wrong here, i'm new php , using interface database client software through www call, have insert script, works, update script im stumped... here queries tried:

the newest one:

$query = "update accounts set moonscore= ' " . $moonscore . " ', sunscore = ' " . $sunscore . " ' name = ' " . $name . "';";

and tried, figured wrong after awhile.

$query = "update accounts set moonscore = $moonscore, sunscore = $sunscore name =$name;

would appreciate help php gurus.

try,

$query = "update accounts set moonscore = '$moonscore', sunscore = '$sunscore' name ='$name'";

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.

how prevent sql injection in php?

php mysql database syntax unity3d

No comments:

Post a Comment