PHP - 不会处理的IF参数错误 - 我做错了什么?

时间:2014-07-29 13:29:51

标签: php mysql

我在最后一个ELSE功能线上收到错误。有点新的MySQL编码所以,如果有人可以告诉我如何修复,为什么,将非常感谢!

if ($password = $old_pw) {
    do {
            if ($new_pw_a = $new_pw_b) {
                $insert_data = ("INSERT INTO #database (password) VALUES ('$new_pw_a')");
                mysql_query($insert_data) or die("<img src='images/fail.png'> Unable to change password due Database - Contact Web Admin!");
                } 
            else { 
                echo "<img src='images/fail.png'> Unable to change password - New Passwords do not match!"; 
                }
            }
            else { 
            echo "<img src='images/fail.png'> Unable to change password - Password Incorrect!"; 
            }
    }

1 个答案:

答案 0 :(得分:0)

试试这个......

if ($password == $old_pw) {
    if ($new_pw_a == $new_pw_b) {
        $insert_data = ("INSERT INTO #database (password) VALUES ('$new_pw_a')");
        mysql_query($insert_data) or die("<img src='images/fail.png'> Unable to change password due Database - Contact Web Admin!");
    } 
    else { 
        echo "<img src='images/fail.png'> Unable to change password - New Passwords do not match!"; 
    }
 }
 else { 
     echo "<img src='images/fail.png'> Unable to change password - Password Incorrect!"; 
 }