this code last time i check was working but it now simply does nothing. Creating the connection to the database seems to be working, however when i put mysqli_stmt_execute($stmt2)
into an if statement, i see that it never returns true and does not work. With no visible errors given even after checking mysqli_error($conn);
i have no idea what is going on. Any help?
$query = "INSERT INTO TempAcc (FirstName, LastName, Email, Password, Hash)
VALUES ( ?, ?, ?, ?, ?)";
$arg1 = $fname;
$arg2 = $lname;
$arg3 = $email;
$arg4 = $pass1;
$arg5 = $hash;
$type = "sssss";
$ini_array = parse_ini_file(realpath(dirname(__FILE__))."/../etc/docs/config.ini");
$servername = $ini_array['servername'];
$username = $ini_array['user'];
$password = $ini_array['pass'];
$dbname = $ini_array['dbname'];
$conn = mysqli_connect($servername, $username, $password, $dbname);
if ($conn->connect_error) {
exit('An error occured');
}else{
print("Connect worked");//always works
}
$stmt2 = mysqli_stmt_init($conn);
mysqli_stmt_prepare($stmt2, $query);
mysqli_stmt_bind_param($stmt2, $type, $arg1, $arg2, $arg3, $arg4, $arg5);
print("Hello1");//this prints out!
if(mysqli_stmt_execute($stmt2)){//this never returns true
print("we are in");//this never executes!
}else{//always goes to else
//there are no errors even though it failed
echo "<script type='text/javascript'>alert('Did not save');</script>";
}
edit: fixed and duplicate