更新php中的密码[关闭]

I am novice to php-mysql ...please help me to rectify the syntax error the error is:

Parse error: syntax error, unexpected T_VARIABLE in /home/u831097172/public_html/php/update.php on line 13

line 13:

UPDATE $tbl_name SET password= '$password' WHERE email='$email';

You have your variable $tbl_name not in quotes $tbl_name has to be '$tbl_name'

maybe you mean something like

$query = "UPDATE $tbl_name SET password = '$password' WHERE email='$email'";

remeber to add slashes to your $password and $email variable to avoid sql-injection

Are the variables filled?

Maybe its better you make

$query = "UPDATE " . $tbl_name . " SET password='" . $password . "'
          WHERE email='" . $email . "'";

And then you can check simple if you print the String out. There you can see if your variables are filled:

print_r($query);

I think you should learn directly with statements:

$mysqliConnection = new mysqli($SERVER, $USER, $PW, $TABLE);
$stmt = mysqliConnection->prepare("UPDATE ? SET password = ? WHERE email = ?");
$stmt->bind_param("sss", $tbl_name, $password, $email);
$stmt->execute();

Here's the doc :) http://es1.php.net/manual/en/mysqli.prepare.php