У меня проблема с тем, что при поиске слова оно не отображается, и появляется эта ошибка
Предупреждение: mysqli_fetch_array () ожидает, что параметр 1 будет mysqli_result, логическое значение задано вC: \ xampp \ htdocs \ public_html \ filterdata.php в строке 213).
Он показывает только таблицу до фильтрации
<?php
include("auth_admin.php");
if(isset($_POST['search']))
{
$valueToSearch = $_POST['valueToSearch'];
// search in all table columns
// using concat mysql function
$query = "SELECT * FROM `lcho_dengue_activities` CONCAT(`id`, `month`, `year`, `dengue_ind1`) where `month`= '".$valueToSearch."'";
$search_result = filterTable($query);
}
else {
$query = "SELECT * FROM `lcho_dengue_activities`";
$search_result = filterTable($query);
}
// function to connect and execute the query
function filterTable($query)
{
$connect = mysqli_connect("localhost", "root", "", "lcho_login");
$filter_Result = mysqli_query($connect, $query);
return $filter_Result;
}
?>
<form action="filterdata.php" method="post">
<input type="text" name="valueToSearch" placeholder="Value To Search"><br><br>
<input type="submit" name="search" value="Filter"><br><br>
<table>
<tr>
<th>Id</th>
<th>Month</th>
<th>Year</th>
<th>dengue_ind1</th>
</tr>
<!-- populate table from mysql database -->
<?php while($row = mysqli_fetch_array($search_result)):?>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['month'];?></td>
<td><?php echo $row['year'];?></td>
<td><?php echo $row['dengue_ind1'];?></td>
</tr>
<?php endwhile;?>
</table>
</form>
//while($row = mysqli_fetch_array($search_result))
- это моя строка 213
Я пытался изменить $search_result
на $query
ипроисходит та же ошибка.