PHP executes MySQL statement problem
$id = 1; This is OK, no problem.
This execution is wrong
$sql = "Update admin set pass= ' $pass 1 ' where id= $id;";
$mysql =new mysqlhelper ();
$count = $mysql->query ($sql);
$mysql. Close ();
You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near "at line 1
This execution is correct.
$sql = "Update admin set pass= ' $pass 1 ' where id=1;";
$mysql =new mysqlhelper ();
$count = $mysql->query ($sql);
$mysql. Close ();
Share to:
------Solution--------------------
Print out $sql and you'll know.
------Solution--------------------
References:
$id = 1; This is OK, no problem.
This execution is wrong
$sql = "Update admin set pass= ' $pass 1 ' where id= $id;";
$mysql =new mysqlhelper ();
$count = $mysql->query ($sql);
$mysql. Close ();
You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near "at line 1
This execution is correct.
$sql = "Update admin set pass= ' $pass 1 ' where id=1;";
$mysql =new mysqlhelper ();
$count = $mysql->query ($sql);
$mysql. Close ();
The red part has a semicolon.
------Solution--------------------
$sql = "Update admin set pass= '". $pass 1. "' where id= $id; '; Change it to this test.
------Solution--------------------
2L positive solution do not need to add a semicolon version of the big say is to solve this kind of problem common approach: query encountered a problem first print out a SQL statement check out nine to ten.
------Solution--------------------
$pass 1 = "123";
$id = 1;
$sql = "Update admin set pass= '". $pass 1. "' where id= $id; ';
Echo $sql;
?>
Tested, and that's really the problem.
------Solution--------------------
$sql = "Update admin set pass= '". $pass 1. "' Where id= '. $id;