通過我的代碼徹底搜索後,我可以確定此錯誤的唯一原因是我用於將字符串轉換爲MD5的技術無效。但是我找不到另一種方式來這樣做。使用MD5值更新MySQL數據庫
$username = $_POST['username'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
if($password=$repassword) {
$con=mysql_connect("localhost", "root", "");
if($con == true) {
mysql_select_db("movedb", $con);
//$newpassword = mysql_real_escape_string(md5($_POST['password']));
$query = "UPDATE user SET password=MD5('$password') WHERE username='$username'";
// $query = "UPDATE user SET password='$newpassword' WHERE username='$username'";
$result = mysql_query($query, $con);
if($result == true) {
echo "Successfully saved your message";
} else {
echo mysql_error();
}
mysql_close($con);
} else {
echo "Cannot connect to the database";
}
} else {
echo "Passwords do not match!";
}
如何從PHP
什麼是「這個錯誤」? – deceze 2012-07-24 11:41:22
並修復,如果你正在分配給它,你沒有比較 – Gntem 2012-07-24 11:42:41
沒有獲得錯誤信息 – Yoosuf 2012-07-24 11:46:17