MySQL Forums
Forum List  »  PHP

Re: Query with PHP variables not returning correct result.
Posted by: Richard Dunne
Date: March 20, 2015 09:30AM

My updated code:
include 'connect.php';
$Con = new mysqli($Host, $Username, $Password, $Db) or die(mysql_error()); // Connect to database server(localhost) with username and password.
if(isset($_GET['Email']) && !empty($_GET['Email']) AND isset($_GET['Hash']) && !empty($_GET['Hash']))
{
// Verify data
$Email = mysqli_real_escape_string($Con,$_GET['Email']); // Set email variable
$Hash = mysqli_real_escape_string($Con,$_GET['Hash']); // Set hash variable
$search = $Con->query("SELECT * FROM members_security WHERE Email='.$Email.' and Active='0'");
$result = mysqli_fetch_array($search);
$numRows = mysqli_num_rows($result);
echo $numRows;
This is the error:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given
Can't figure out why the select query isn't returning something.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.