I have this code and want you ask if the while ($row = mysqli_fetch_assoc($result_table_main)) ends when there are no rows anymore in result set? Do not understand why ist ends because the while has no counter. This is the only question in my post. Maybe you can give me a proper explaination.
I worked very long on it, because I did not know very much about this before. Now I need to doucument my work.
Thanks for your answer!
<?php
$sql_table_main = "SELECT id,name_Gleitzeitrahmen, name_Abweichungen, name_Mehrarbeitervolumen, name_Mehrarbeit1, name_Ausgleich, name_Mehrarbeit2, name_Personalmassnahmen, name_Ueberstunden, name_Ueberstunden_abzusehen, name_Klaerungsbedarfe1, name_Klaerungsbedarfe2 FROM landrat_dashboard";
$result_table_main = mysqli_query($con, $sql_table_main);
?>
<div class="card-content table-responsive table-maxheight" style="overflow:scroll;">
<table class="table table-hover table-mc-green table-bordered table-striped table-condensed">
<thead class="text-primary">
<th class="thbackground_green">ID</th>
<th class="thbackground_green">Gleitzeitrahmen</th>
<th class="thwidth thbackground_green">Abweichungen</th>
<th class="thwidth thbackground_green">Mehrarbeitervolumen</th>
<th class="thwidth thbackground_green">Mehrarbeit</th>
<th class="thwidth thbackground_green">Ausgleich</th>
<th class="thwidth thbackground_green">Mehrarbeit</th>
<th class="thwidth thbackground_green">Personalmaßnahmen</th>
<th class="thwidth thbackground_green">Überstunden im Rahmen?</th>
<th class="thwidth thbackground_green">Sind Überstunden abzusehen?</th>
<th class="thbackground_green">Klärungsbedarfe</th>
<th class="thwidth thbackground_green">Klärungsbedarfe Beschreibung</th>
</thead>
<tbody>
<?php
if(mysqli_num_rows($result_table_main) > 0){
while ($row = mysqli_fetch_assoc($result_table_main)) {
echo '<tr>';
echo '<td>'. $row['id'] .'</td>';
echo '<td>'. $row['name_Gleitzeitrahmen'] .'</td>';
echo '<td>'. $row['name_Abweichungen'] .'</td>';
echo '<td>'. $row['name_Mehrarbeitervolumen'] .'</td>';
echo '<td>'. $row['name_Mehrarbeit1'] .'</td>';
echo '<td>'. $row['name_Ausgleich'] .'</td>';
echo '<td>'. $row['name_Mehrarbeit2'] .'</td>';
echo '<td>'. $row['name_Personalmassnahmen'] .'</td>';
echo '<td>'. $row['name_Ueberstunden'] .'</td>';
echo '<td>'. $row['name_Ueberstunden_abzusehen'] .'</td>';
echo '<td>'. $row['name_Klaerungsbedarfe1'] .'</td>';
echo '<td>'. $row['name_Klaerungsbedarfe2'] .'</td>';
echo '</tr>';
}
}
?>
</tbody>
</table>