So I am attempting to use MySQLi, however, I keep getting thrown the error
Fatal error: Call to a member function query() on null in /home/u740966689/public_html/dashboard/API/infFunctions.php on line 78
I'm unsure why this is... I read up on some other questions and changed a few things such as how I connect to the database but I still get the error.
MY CODE:
File 1:
require 'infFunctions.php';
$DatabaseHost = '***';
$DatabaseUser = '***';
$DatabasePass = '***';
$DatabaseName = '***';
$mysqli = new mysqli("$DatabaseHost","$DatabaseUser","$DatabasePass","u740966689_site") or die ("infAPI | Could not connect to the database");
if (isset($_GET['Type'])){
$Type = $_GET['Type'];
if ($Type == 'Register') {
$Response = Signup($_GET['name'],$_GET['password'],$_GET['email']);
if ($Response == '1') {
$resp = 'success';
} else if ($Response == '2') {
$resp = 'error_one';
} else if ($Response == '3') {
$resp = 'error_two';
} else {
$resp = 'error_three';
}
echo $resp;
}
}
file 2:
function Signup($Username, $Password, $Email){
$UserArray = $mysqli->query("SELECT * FROM infWebAccounts WHERE Username='$Username'");
$UserArray2 = $mysqli->query("SELECT * FROM infPendingAccounts WHERE Username='$Username'");
if (mysqli_num_rows($UserArray) == 0 AND mysqli_num_rows($UserArray2) == 0){
$Password = hash("sha512",$Password);
$Query = $mysqli->query("INSERT INTO infPendingAccounts (Username,Password,Email,Verified) VALUES ('$Username','$Password','$Email',N')");
return '1';
}elseif (mysqli_num_rows($UserArray) > 0 ){
return '2';
}else{
return '3';
}
}