警告:mysqli_fetch_array()要求参数1为mysqli_result,第62行给出布尔值

时间:2018-05-17 05:42:06

标签: php html

我不明白如何在第62行解决这个问题你能帮帮我吗?... 这是edit.php文件...... DATABASE连接成功没有问题, 发布post.php有效,我有来自edit.php文件的错误,错误

<?php
// including the database connection file
include_once("config.php");

if(isset($_POST['update']))
{   

    $id = mysqli_real_escape_string($mysqli, $_POST['id']);

    $steamUE = mysqli_real_escape_string($mysqli, $_POST['steamUE']);
    $steamPW = mysqli_real_escape_string($mysqli, $_POST['steamPW']);
    $steamGC = mysqli_real_escape_string($mysqli, $_POST['steamGC']);   

    // checking empty fields
    if(empty($steamUE) || empty($steamPW) || empty($steamGC)) { 

        if(empty($steamUE)) {
            echo "<div class='container'>";
            echo "<font color='red'>Steam Username field is empty.</font><br/>";
            echo "</div>";
            echo "<br/>";
        }

        if(empty($steamPW)) {
            echo "<div class='container'>";
            echo "<font color='red'>Steam Password field is empty.</font><br/>";
            echo "</div>";
            echo "<br/>";
        }

        if(empty($steamGC)) {
            echo "<div class='container'>";
            echo "<font color='red'>Steam Guard Code field is empty.</font><br/>";
            echo "</div>";
        }       
    } else {    
        //updating the table
        $result = mysqli_query($mysqli, "UPDATE `user` SET steamUE='$steamUE',steamPW='$steamPW',steamGC='$steamGC' WHERE id=$id");

        //redirectig to the display page. In our case, it is index.php
        header("Location: index.php");
    }
}
?>        
<?php
        //getting id from url
        $id = $_GET['id'];

        //selecting data associated with this particular id
        $result = mysqli_query($mysqli, "SELECT * FROM `user` WHERE id=$id");

        while($res = mysqli_fetch_array($result))
        {
            $steamUE = $res['steamUE'];
            $steamPW = $res['steamPW'];
            $steamGC = $res['steamGC'];
        }
        ?>

这是第62行:

 while($res = mysqli_fetch_array($result))

db连接文件included_once来自...... 这是config.php 现在您可以看到文件已连接 我没有任何MySQL连接错误

<?php

$databaseHost = 'sql.website.com';
$databaseName = '';
$databaseUsername = '';
$databasePassword = '';

$mysqli = mysqli_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName); 

?>

0 个答案:

没有答案