简体   繁体   English

无法获取PHP Rest Server Post方法来更新数据库

[英]Can't get PHP rest server post method to update database

I am creating an android app with a php Rest server with firebird database. 我正在使用带Firebird数据库的php Rest服务器创建一个Android应用程序。 I can get information from the database via json with php server but I can't update anything. 我可以通过php服务器通过json从数据库中获取信息,但是我什么也无法更新。 Here is my code. 这是我的代码。

public function update_user_info (){

        $fname = $_POST['fname'];
        $lname = $_POST['lname'];
        $address = $_POST['address'];
        $city = $_POST['city'];
        $state = $_POST['state'];
        $zip = $_POST['zip'];
        $home = $_POST['home'];
        $cell = $_POST['cell'];
        $birthdate = $_POST['birthdate'];
        $weekly = $_POST['weekly'];
        $email = $_POST['email'];
        $users_id = $_POST[users_id];
        $last_active = date("m/d/Y", time());
        $last_act_time = date("h:i:s", time());

        $acct_email = strtolower($email);
    //make email all lowercase


        horse_connect();
        $query = ibase_prepare("UPDATE USERS SET FIRST_NAME = ?,
                               LAST_NAME = ?, ADDRESS = ?, CITY = ?,
                               STATE = ?, ZIP = ?, HOME_PHONE = ?, CELL_PHONE = ?,
                               BIRTHDATE = ?, HTML_EMAIL = ?,
                               LAST_ACTIVE = ?,
                               LAST_ACT_TIME = ?, EMAIL_NEWS = ?, EMAIL_LIVE_SCORES = ?
                               WHERE USERS_ID = ?");

        $result = ibase_execute($query, $fname, $lname,
                     $address, $city, $state, $zip,
                     $home, $cell, $birthdate,
                     $acct_email, $last_active, $last_act_time,
                     $weekly, $live, $users_id);

        //$final_array = array('user id' => $fname);
        if($Result)
            $json = array("status" => 1);
        else
            $json = array("status" =>0);
        echo json_encode($json);
  } //end: update_user_info

I am using Advanced rest client for testing. 我正在使用高级Rest Client进行测试。

Try using ibase_commit after execute. 执行后尝试使用ibase_commit。 If possible try to use PDO when working with database. 如果可能,请在使用数据库时尝试使用PDO

Thanks everyone but I found the Problem. 谢谢大家,但我发现了问题。 HTML_EMAIL should be ACCT_EMAIL. HTML_EMAIL应该为ACCT_EMAIL。 HTML_EMAIL is a bit field, true or false. HTML_EMAIL是一个位字段,为true或false。 ACCT_EMAIL is a string ACCT_EMAIL是一个字符串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM