mysqli没被执行

时间:2016-12-31 10:04:07

标签: php mysqli

我在Godaddy托管我的网站。我的网站与localhost(WampServer)工作正常,但相同的代码在GoDaddy中不起作用。这是我的代码:

 <?php 

include "DBConstants.php";
include "DBGeneral.php";
include "MailHelper.php";

$email = $_GET["email"];
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
$db = new DBConstants();

$connection = new mysqli($db->SERVER_NAME,$db->DB_USERNAME,$db->DB_PASSWORD,$db->DB_NAME);
 //$db->server_name = "localhost"


if(!filter_var($email,FILTER_VALIDATE_EMAIL) === false ){
$dbGen = new DBGeneral();

if(!$dbGen->checkIfUserSubscribed($email,$connection)){
$query = "INSERT INTO mailinglist (email, validationID, usRequest, isValidated) VALUES (?,?,?,?)";
echo $query;
$statement = $connection->prepare($query);

$validationID = bin2hex(openssl_random_pseudo_bytes ( 10, $crstrong));
$usRequest=0;
$isValidated = 0;

//Everything works fine till here
$statement->bind_param("ssii",$email,$validationID,$usRequest,$isValidated);

//This line is not being executed
$statement->execute();

 echo "statement executed";

$statement->close();
$connection->close();



$array = array("result"=>true,"message"=>"We have sent you a email<br/> Please verify to subscribe","Message Sent"=>$isSent);

echo json_encode($array); 
    }
    else{

        echo json_encode(array("result"=>"false","message"=>"You have already subscribed or <br/> Please verify your email to subscribe","Message Sent"=>false));
    }

}
else{
    echo json_encode(array("result"=>"false","message"=>"Sorry something went wrong","Message Sent"=>false));
}




?>

我没有收到任何错误消息。在localhost(WampServer)上运行时,相同的代码工作正常。我哪里出错了,$db->SERVER_NAME = "localhost"我应该更改服务器名称吗?

0 个答案:

没有答案