Please, I will really appreciate contributions. I am new to using the PHP script to apply filter on forms built with mysqli database.
I get this error when I try to process the search with my filter parameters:
Warning : Invalid argument supplied for foreach()
-{$filtervalues = $_GET[‘search’];
$query = "SELECT * FROM users WHERE CONCAT(CabNo, TruckNo, driverSAP) LIKE '%$filtervalues%'";
$query_run = mysqli_query($conn, $query);
if(!$query_run||mysqli_num_rows($query_run) == 0)
{
foreach($query_run as $items)
{
?>
<tr>
<td><?= $items['id']; ?></td>
<td><?= $items['CabNo']; ?></td>
<td><?= $items['TruckNo']; ?></td>
<td><?= $items['TransitDiv']; ?></td>
}—
The line of this error is : foreach($query_run as $items)
Please help out kindly.