I'm looking for a way to check if my mysqli_query result is empty.
My code:
$result = mysqli_query($con, "SELECT ......");
Then there is the table head:
<table class="table table-striped" width="100%">
<thead>
<table class="table table-striped" width="100%">
<thead>
<th>Jahr</th>
And then I generate the rows with a while loop:
while($ausgabe = mysqli_fetch_object($result)){ ?>
<tr>
<td><?php echo $ausgabe->jahr; ?></td>
And now I want to make an if query to check if I have to display the table, before the table begins, something like this:
if($result){
<table class="table table-striped" width="100%">
<thead>
<th>Jahr</th>
But this does not work, it only works with asking if mysqli_fetch_object is empty but this code is below my table head so I can't use this.
Do you have any ideas?