dongye9228 2014-02-12 22:11
浏览 169

mysqli_fetch_row()期望参数1为mysqli_result

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?

  • 写回答

4条回答 默认 最新

  • dpi74187 2014-02-12 22:22
    关注

    change that if statment to

      if(!$result) {
    
    评论

报告相同问题?

悬赏问题

  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行