不能在服务器中处理我的$_POST数据**EDIT**准备好的语句没有正确执行


Can't process my $_POST data in the server **EDIT** Prepared statements not properly executed

我有这样一个场景。我有一个android应用程序发送一个post变量到服务器上的php文件。我在服务器上有一个php文件,它接受一个post变量,并根据收到的变量执行一个函数。

我可以回显这些变量,我将在我的设备上接收它们。

我可以自己设置$action变量,它将根据需要由开关处理。

但是我不能发送我自己的变量并处理它,因为它应该能够。

我试着将php文件的权限设置为777,但没有成功。

下面是代码。所有的帮助都将是感激的。谢谢。

<?php
require_once('config.php');
require_once('functions.php');
$action = $_POST['action'];
if(isset($action) && !empty($action)){
        $connection = connect(USERNAME, PASSWORD, DATABASE);
        switch($action){
            case "sign_up":
            sign_up($connection);
            break;
            case "social_sign_up":
            social_sign_up($connection);
            break;
            case "social_sign_in":
            social_sign_in($connection);
            break;
            case "new_testimony":
            new_testimony($connection);
            break;
            case "new_comment":
            new_comment($connection);
            break;
            case "get_all_testimonies":
            get_all_testimonies($connection);
            break;
            case "get_all_comments":
            get_all_comments($connection);
            break;
            case "sign_in":
            sign_in($connection);
            break;
        }
        mysqli_close($con);
    }
?>

编辑我已经将问题隔离到在sign_in函数内执行的预处理语句中。我已经检查了模块是否存在,它确实存在。这是符号输入函数

//sign in
function sign_in($connection){
    if(
        isset($_POST['email']) && !empty($_POST['email']) &&
        isset($_POST['password']) && !empty($_POST['password'])
    ){

        $email = $_POST['email'];
        $password = $_POST['password'];
        $count = NULL;
        $id = NULL;
        $fname = NULL;
        $lname = NULL;
        $stmt = $connection->prepare("select count(*), id, fname, lname from user where email = ? and password = ?");
        $stmt->bind_param("ss", $email, $password);
        if($stmt->execute()){
            $stmt->bind_result($count, $id, $fname, $lname);
            $stmt->fetch();

            if($count == 1)
                echo json_encode(array($id, $fname, $lname));
            else
                echo "Ensure your e-mail and password are correct.";
        }
        $stmt->close();
    } echo false;
}

我得到一个fileNotFoundError在我的设备上,当我试图回声过去的"$stmt = $connection->准备"点。

当您有一个iPage托管数据库时。在php登录时。使用'localhost'甚至'127.0.0.1'都不能连接。您将获得一个格式为username.ipagemysql.com的url。其他任何内容都将抛出错误。将我的服务器从'localhost'更改为此解决了我的问题。