So, I'm having an issue with checking if a variable exists within the db in my registration page.
$Key = mysqli_real_escape_string($mysqli, $_POST['key']);
$result = $mysqli->query("SELECT * FROM def WHERE key='$Key'");
$row = mysqli_fetch_array($result);
$rowcheck = $result->num_rows;
if(is_array($row))
{
//rest of registration continues if key is in the db
}
else
{
//error echo stating key is invalid
}
The problem I am having is that even if the stated key is correct, I am still getting the else statement error. It does not let me register, it will just tell me the key is invalid. What am I doing wrong here? Because if i change is_array to if the $rowcheck = 1 it works, but then typing an invalid key works. given it does not actually register the account, it still stays registration success. Any help will be appreciated, as the rest of the site is set up and I encountered this error after finding the registration successful bug. Thank you again Stackoverflow,
Zero