Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php stmt->;execute()返回false?_Php_Mysql_Mysqli_Prepared Statement - Fatal编程技术网

Php stmt->;execute()返回false?

Php stmt->;execute()返回false?,php,mysql,mysqli,prepared-statement,Php,Mysql,Mysqli,Prepared Statement,出于某种原因,我被过去一年来对我来说很简单的事情缠住了。将数据插入数据库。今天,我一直在试图解决这个问题,我似乎不明白为什么stmt->execute()返回false?!即使打开PHP和MySQLI,我也没有收到任何错误。这是我的密码: else { // We are all good, lets enter this person into our DB $CheckUser->close(); if ($insert_stmt = $mysqli->p

出于某种原因,我被过去一年来对我来说很简单的事情缠住了。将数据插入数据库。今天,我一直在试图解决这个问题,我似乎不明白为什么
stmt->execute()
返回false?!即使打开PHP和MySQLI,我也没有收到任何错误。这是我的密码:

else
{
    // We are all good, lets enter this person into our DB
    $CheckUser->close();
    if ($insert_stmt = $mysqli->prepare("INSERT INTO users (name, email, country, region, city, address, password, salt) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")) {    
       $insert_stmt->bind_param('ssssssss', $name, $email, $geoplugin->countryName, $geoplugin->regoin, $geoplugin->city, $address, $password, $random_salt); 
       if($insert_stmt->execute())
       {
            // Success, redirect the user to his page (Remember to login the user)
            header("Location: dashboard.php");
       }
       else
       {
            // Something happened
            echo "Something Happened";
       }
    }
}

在我的页面上,“发生了什么事”得到了回应。但是,如果我打开MYSQLI错误,那么我在提交后只会得到一个空白页面。我做错了什么??

根据OP的要求从我的评论中给出答案


您可能在
$geoplugin->regoin
中输入错误,打算使用
$geoplugin->region

使用错误处理函数来显示错误消息,而不是显示信息量少得多的“发生了什么事”消息。以及“如果我打开MYSQLI错误”-如何启用它们?详细说明“我打开MYSQLI Errors“请尝试包装PDO函数……捕获:@YourCommonSense
MYSQLI_report(MYSQLI_report_ALL);
再次感谢。这有助于用一双新的眼睛查看我的代码LOL。是的,非常欢迎您的帮助。@EliteGamer干杯