I'm trying to show a "Data not Found" message when query result is empty.
For example, if I have the following invoice IDs in a database:
11
12
13
when user inputs invoice 11, show the data. But when user input 14 data show "data not found".
I have tried the following, but it doesn't work
if ( $SQLshow = '' ) {
echo 'No data found in database!';
}
this my full code
<table>
<tbody>
<?php
$username = $_COOKIE['usernameloc'];
$invoice = $_GET['invoice'];
$SQLshow = mysqli_query($con,"
SELECT *
FROM datapo
where username = '$username'
and Invoice_Number = '$invoice'
ORDER
BY id DESC
limit $offset
, $dataperPage
");
$noUrut = 1;
while($row = mysqli_fetch_array($SQLshow)){
?>
<div>
<tr>
<td><?php echo $row[id]; ?></td>
<td><?php echo $row[Request_Date]; ?></td>
<td><?php echo $row[Partner]; ?></td>
<td><?php echo $row[Package]; ?></td>
</tr>
<?php
$noUrut++;
}
if ( $SQLshow = '' ) {
echo 'No data found in database!';
}
?>
</div>
</tbody>
</table>