I have read a lot of these and they are for the most part and error in the database connection or the query. I am getting this error and I have a good connection and a good query. I know this because I print_r or echo the results of the $row and I get matching results.
<?php
if (!isset($_POST['submit'])) {
header("Location: http://tsec.tleeaa.org");
exit;
}
?>
<?php
session_start();
require_once('Connections/db_tsectleeaa_connection.php');
require_once("_includes/functions.php");
?>
<?php $_SESSION['leadadv_email'] = $_POST['leadadv_email']; $email_compare = $_SESSION['leadadv_email']; ?>
<?php
$dbquery = "SELECT * ";
$dbquery .= "FROM `tsec_team_registration` ";
$dbquery .= "WHERE `leadadv_email` = ";
$dbquery .= " '$email_compare' " ;
$result = mysqli_query($db_tsectleeaa_connection, $dbquery);
if(!isset($result)) {
die("Database query failed");
}
while ($row = mysqli_fetch_row($result)){
print_r($row[10]); //should match next line
echo "<br />".$email_compare."<br />"; //should match line above
if ($row[10] === $email_compare){
echo "match!";
} else echo "no match!";
}
?>
the big problem is that the IF statement doesn't work. It will work when the statement is true but will not to to 'else' if it is false.
What this page does is verify against an email put in the previous page. Once they hit 'submit' the action for the form is this page. When the database has bacon@burger in the correct place and the user uses bacon@burger for the email address, the following result happens: bacon@burger bacon@burger match!
I am still getting this error:
( ! ) Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\index_action.php on line 24
Call Stack
# Time Memory Function Location
1 0.0005 256032 {main}( ) ..\index_action.php:0
2 0.0052 273264 mysqli_fetch_row ( ) ..\index_action.php:24
can anyone point me in the direction of what might be going on, please?