Hi ich habe mir jetzt ein Script zum Ausgeben von Bildern eines Albums geschrieben, das folgendermaßen aussieht.
PHP-Code:
Dieses erste Script wird am Amfang der Seite zum Abfragen aller Daten verwendet (Ich weiß, dass es etwas veraltet ist
)
Zum Ausgeben für das erste Ergebniss wird dann folgendes Script verwendet
PHP-Code:
Und zum ausgeben der Thumbs dieses Script
PHP-Code:
Im Grunde geht es nur um das letzte Script. Im Moment gibt das Script alle Thumbs in einer Tabellenzeile aus. Wie kann ich das begrenzen und sagen, dass nach jedem 5. Bild eine neue Zeile angefangen werden soll?
Mfg, winKi
PHP-Code:
PHP-Code:
<?php
// Include-Dateien hinzufügen
include('inc/config.php');
// Verbindung zum MySQL-Server
$db = mysql_connect ($db_host, $db_username, $db_passwd)
or die("Keine Verbindung möglich: " . mysql_error());
mysql_select_db ($db_db, $db);
// Datensatz-Ausgabe festlegen
$anfrage = "SELECT * FROM test_thumbs WHERE thumb_pruef=1 AND photo_cat_id=".$_GET['cat'];
$result = mysql_query($anfrage);
// Anzahl der Datensätze in eine Variable schreiben
$anz = mysql_num_rows($result);
// Datensatz-Ausgabe festlegen
$sql_1 = "SELECT * FROM test_photo_cats WHERE cat_pruef=1 AND cat_id=".$_GET['cat'];
$result_1 = mysql_db_query($db_db, $sql_1);
// Datensatz-Ausgabe festlegen
$sql_2 = "SELECT * FROM test_thumbs WHERE thumb_pruef=1 AND photo_cat_id=".$_GET['cat']." ORDER BY thumb_id DESC";
$result_2 = mysql_db_query($db_db, $sql_2);
// Verbindung zur Datenbank beenden
mysql_close($db);
?>
Zum Ausgeben für das erste Ergebniss wird dann folgendes Script verwendet
PHP-Code:
PHP-Code:
<?php
while($row1 = mysql_fetch_array($result_1)) {
extract($row1);
$datum = date("d.m.Y", strtotime($cat_datum));
echo " <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"649\">\n";
echo " <tbody><tr>\n";
echo " <td class=\"table_title_bg\" height=\"19\" valign=\"bottom\">\n";
echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"3\" height=\"18\" width=\"100%\">\n";
echo " <tbody><tr>\n";
echo " <td class=\"table_title\">‹Album›</td>\n";
echo " <td class=\"table_title_info\" width=\"220\">$datum | Bilder</td>\n";
echo " </tr></tbody>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>";
echo " <tr>";
echo " <td>";
echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo " <tbody><tr>\n";
echo " <td align=\"center\" valign=\"top\">\n";
echo " <table style=\"border: solid #CCC; border-width: 0 1px 1px 1px;\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">\n";
echo " <tbody><tr class=\"bg_td\">\n";
echo " <td class=\"bg_td\" align=\"center\" height=\"88\" valign=\"middle\" width=\"110\"><img alt=\"$cat_name\" src=\"$cat_pfad\" class=\"picture\" title=\"$cat_name\" height=\"56\" width=\"75\"></td>\n";
echo " <td style=\"border: solid #CCC; border-width: 0 1px;\" height=\"88\" valign=\"top\" width=\"180\">\n";
echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo " <tbody><tr>\n";
echo " <td class=\"normal_file_title\" style=\"text-transform: capitalize;\">[b]$cat_name[/b]</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>
\n";
echo " › $cat_cat
\n";
echo " › $datum
\n";
echo " › $anzahl_pictures</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>\n";
echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"5\" width=\"100%\">\n";
echo " <tbody><tr>\n";
echo " <td><a href=\"?p=photos\">zurück zu den Alben</a></td>\n";
echo " </tr></tbody>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr></tbody>\n";
echo " </table>\n";
echo " </td>\n";
echo " <td class=\"bg_td\" height=\"88\" valign=\"top\">\n";
echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo " <tbody><tr>\n";
echo " <td align=\"justify\">$cat_text</td>\n";
echo " </tr></tbody>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr></tbody>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr></tbody>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </tbody>\n";
echo " </table>\n";
}
?>
PHP-Code:
PHP-Code:
<?php
while($row2 = mysql_fetch_array($result_2)) {
extract($row2);
echo " <td align=\"center\" height=\"80\"><a href=\"\"><img src=\"$thumb_pfad\" title=\"$thumb_pfad\" alt=\"$thumb_pfad\" class=\"picture\" height=\"75\" width=\"100\"></a>
</td>\n";
}
?>
Mfg, winKi

Kommentar