Ik heb code geschreven met twee while loops. De bedoeling is dat 1 while loop de data naast elkaar laat zien ($sql), op dit moment laat hij de data wel naast elkaar zien maar dan alleen de eerste record uit de database, dit zijn vier records.
mijn vraag is: hoe kun je gegevens naast elkaar laten zien met twee while loops?
alvast bedankt.
<?php
$teller = 0;
$naast_elkaar = 4;
$query = "SELECT * FROM tblfoto ";
$sql = "SELECT voornaam FROM tblredactie ";
$result = mysqli_query($dbcon, $query) or die(mysqli_error());
$row = mysqli_query($dbcon, $sql) or die(mysqli_error());
echo "<table border='1'>";
echo "<tr>";
while ($ehv = mysqli_fetch_assoc($row)) {
while ($record = mysqli_fetch_assoc($result)) {
$id = $record['id'];
$lid1 = $record['comm1'];
$lid2 = $record['comm2'];
$thumb = $record['img_thumb'];
$imgorg = $record['img_org'];
$titel = $record ['titel'];
$redactielid = $ehv['voornaam'];
echo "<th></th>";
echo "<th> $titel </th>";
echo "<th> </th>";
echo "<th></th>";
echo "<th></th>";
echo "</tr>";
echo "<tr>";
?>
<!--<tr>-->
<?php echo ($teller % $naast_elkaar) == 0 ? '<tr>' : ''; ?>
<th></th>
<th><?php echo $redactielid ?></th>
<th><?php echo $redactielid; ?></th>
<th><?php echo $redactielid; ?></th>
<th><?php echo $redactielid; ?></th>
<?php $teller++;
echo ($teller % $naast_elkaar) == 0 ? '</tr>' : '';
?>
<!-- </tr>-->
<form action="wijzig.php" id="checkbox" method="POST">
<tr>
<td></td>
<td></td>
</tr>
<td><?php echo '<a id="example1" href="'. $imgorg .'"><img src="'.$thumb.'" alt="thumb"></a>'; ?></td>
<td><textarea name="lid1" ><?php echo $lid1; ?></textarea></td>
<td><textarea name="lid2" ><?php echo $lid2; ?></textarea></td>
<td><input type="submit" value="Update" name="update" />Update</td>
<script>
</script>
</form>
<?php
echo "</tr>";
}}
if(($teller % $naast_elkaar) != 0)
{
for($dummy_count=$teller;($dummy_count % $naast_elkaar) != 0;$dummy_count++)
{
echo '<td> </td>';
}
echo '</tr>';
}
echo "</table>";
?>