当我尝试在phpmyadmin中搜索数据库中的数据时出现此错误

时间:2018-06-29 03:01:34

标签: php mysql

当我尝试在phpmyadmin中搜索数据库中的数据时出现此错误,这是错误

  

警告:mysqli_fetch_array()期望参数1为mysqli_result,在79行的C:\ xampp \ htdocs \ project \ historydisplay.php中给出的布尔值

我尝试搜索它,但是没有用。

这是我的代码BTW

<?php

if(isset($_POST['search']))
{
$valueToSearch = $_POST['valueToSearch'];

$query = "SELECT * FROM fsd WHERE CONCAT(ID, Department, User, Computer Name, 
Monitor Model, Back-UPS Model, Processor, Operating System) LIKE 
'%".$valueToSearch."%'";
$search_result = filterTable($query);

}
else {
$query = "SELECT * FROM fsd";
$search_result = filterTable($query);
}

function filterTable($query)
{
$connect = mysqli_connect("localhost", "root", "", "subdivision");
$filter_Result = mysqli_query($connect, $query);
return $filter_Result;
}

?>

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="css/SearchBoxStyle.css">
    <link rel="stylesheet" href="css/TableStyle2.css">



</head>
<body>    
    <form action="historydisplay.php" method="post" class="flexsearch--form">

   <div class="flexsearch">
    <div class="flexsearch--wrapper">

            <div class="flexsearch--input-wrapper">
            <input class="flexsearch--input" type="text" placeholder="ValueTo 
Search" name="valueToSearch">
            </div>
            <input class="flexsearch--submit" type="submit" value="&#10140;" 
name="search"/>

    </div>
</div>

        <br><br><br><br>
        <table align='center' class="container">
            <div class="tbl-header"> 
                <thead> 
                <tr>
                    <th colspan='8' align="center"><font 
size="20">History</font></th>
              </thead> 
            </tr>
              <thead> 
            <tr>
                <th>ID</th>
                <th>Department</th>
                <th>User</th>
                <th>Computer Name</th>
                <th>Monitor Model</th>
                <th>Back-UPS Model</th>
                <th>Processor</th>
                <th>Operating System</th>
                  </thead> 
            </tr>
         </div>
            <div class="tbl-content">    
            <?php while($row = mysqli_fetch_array($search_result)):?>
                  <thead> 
            <tr>
                <td><?php echo $row['ID'];?></td>
                <td><?php echo $row['Department'];?></td>
                <td><?php echo $row['User'];?></td>
                <td><?php echo $row['Computer Name'];?></td>
                <td><?php echo $row['Monitor Model'];?></td>
                <td><?php echo $row['Back-UPS Model'];?></td>
                <td><?php echo $row['Processor'];?></td>
                <td><?php echo $row['Operating System'];?></td>

                  </thead> 
            </tr>
            <?php endwhile;?>
            </div>
        </table>
                                                    </form>

</body>
</html>

0 个答案:

没有答案