I am hosting my website in Godaddy. My website works fine with localhost (WampServer) but the same code is not working in GoDaddy. This is my code:
<?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));
}
?>
I am not getting any error messages.The same code works fine when run on a localhost (WampServer). Where am I going wrong and $db->SERVER_NAME = "localhost"
should I change the server name?