Hallo,
ich möchte mit dem Script erreichen, dass nach jedem 5ten Bild eine neue Zeile kommt und das mit einer Tabelle ...
HTML-Code:
<table>
<tr>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
</tr>
<tr>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
<td valign="top"><img src="#"></td>
</tr>
</table>
usw...
Das Script:
PHP-Code:
<?php
include "inc/header.php";
$sql = "SELECT * FROM pics ORDER BY id DESC";
$result = $db->query($sql);
if (!$result) {
exit;
}
echo "<table>\n";
while($row = $result->fetch_assoc()) {
if ($row['id'] % 3 == 2)
{
echo "<tr>\n";
echo "<td valign=\"top\"><img src=\"img/pics/".$row['thumb']."\"></td>\n";
}
else
{
echo "<td valign=\"top\"><img src=\"img/pics/".$row['thumb']."\"></td>\n";
}
if ($row['id'] % 4 == 2)
{
echo "</tr>\n";
}
}
echo "</table>\n";
$result->close();
unset($result);
include "inc/footer.php";
?>
Nun in etwa funktioniert das ganze auch, aber nicht richtig.
schon einmal danke für die Antwort.