托管后,为什么我的php命令不起作用?

时间:2020-02-23 09:57:24

标签: php html sql web host

我托管了我的网站,然后突然将用于将记录插入数据库的php命令不起作用。

这是命令的代码,成功消息有效,但记录未插入数据库中。当我在本地运行网站时,它可以正常运行。我网站上的某些命令可以插入数据库,但有些命令正像此问题一样,成功消息有效,但数据库未更改

function doInsert(){
    global $mydb;
    if(isset($_POST['save'])){


    if ($_POST['U_NAME'] == "" OR $_POST['U_USERNAME'] == "" OR $_POST['U_PASS'] == "") {
        $messageStats = false;
        message("All field is required!","error");
        redirect('index.php?view=add');
    }else{  

        $sql = "SELECT * FROM useraccounts WHERE ACCOUNT_USERNAME='" .$_POST['U_USERNAME']."'";
        $mydb->setQuery($sql);
        $userresult = $mydb->loadSingleResult(); 
        if ($userresult) {
            # code...
            message("Username is already taken.", "error");
            redirect('index.php?view=add');
        }else{

        $user = New User();
        $user->USERID               = $_POST['user_id'];
        $user->ACCOUNT_NAME         = $_POST['U_NAME'];
        $user->ACCOUNT_USERNAME     = $_POST['U_USERNAME'];
        $user->ACCOUNT_PASSWORD     =sha1($_POST['U_PASS']);

        $user->ACCOUNT_TYPE         =  $_POST['U_ROLE'];
        $user->create();

        message("New [". $_POST['U_NAME'] ."] created successfully!", "success");
        redirect("index.php");

        } 
    }
    }

}

0 个答案:

没有答案