stmt-> execute()返回false?

时间:2014-03-08 16:59:33

标签: php mysql mysqli prepared-statement

出于某种原因,我被困在过去一年对我来说很简单的事情上。将数据插入数据库。今天,我一直试图解决这个问题,我似乎无法理解为什么stmt->execute()返回错误?!即使我打开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错误,那么我提交后就会得到一个空白页面。我做错了什么???

1 个答案:

答案 0 :(得分:0)

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

您可能在$geoplugin->regoin中输了一个拼写错误并打算使用$geoplugin->region