Ich hoffe, ich bin hier richtig.
Und ich hoffe, dass ich mein Problem verständlich schildern kann.
Mehrere Images möchte ich in einer Tabelle in 2 Spalten anzeigen. Die Images befinden sich bisher in einer Zeile.
Da ich recht wenig Ahnung von PHP und MySQL habe, sitze ich schon seit gestern an dem scheiß Problem und komme nicht weiter.
Hier erstmal Code:
PHP-Code:
if ($z1_artikel!='0') {
print ("<table>");
$sql2_topartikel = "SELECT * FROM topartikel ORDER by top_id";
$res2_topartikel = mysql_query($sql2_topartikel);
while($row = mysql_fetch_assoc($res2_topartikel)) {
$top_id = $row['top_id']; $top_artid = $row['top_artid'];
$sql2_artikel = "SELECT * FROM artikel WHERE art_id = '$top_artid'";
$res2_artikel = mysql_query($sql2_artikel);
while($row = mysql_fetch_assoc($res2_artikel)) {
$art_id = $row['art_id']; $art_kat = $row['art_kat']; $art_nr = $row['art_nr']; $art_titel = $row['art_titel']; $art_img = $row['art_img']; $art_imgw = $row['art_imgw']; $art_imgh = $row['art_imgh']; $art_datei = $row['art_datei']; $art_size = $row['art_size']; $art_demo = $row['art_demo']; $art_descr = $row['art_descr']; $art_preis1 = $row['art_preis1']; $art_preis2 = $row['art_preis2']; $art_preis3 = $row['art_preis3']; $art_preis4 = $row['art_preis4']; $art_liz1 = $row['art_liz1']; $art_liz2 = $row['art_liz2']; $art_liz3 = $row['art_liz3']; $art_liz4 = $row['art_liz4'];
if ($art_img=='') {$image="img/noimage150.png"; $breite=150; $hoehe=120;}
else {$image="artikel/".$art_img;
if ($art_imgw>=$art_imgh) {
$breite = "320"; $brprozent = ((110 * $breite) / $art_imgw);
$hoehe = (($art_imgh * $brprozent) / 75); $hoehe = (ceil ($hoehe));
}
else { $hoehe = "120"; $brprozent = ((100 * $hoehe) / $art_imgh);
$breite = (($art_imgw * $brprozent) / 100); $breite = (ceil ($breite));
}
}
print ("<td width=340>
<table width=340 border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2 height=130 style='border:1px solid #CCCCCC;' align=center><a href='details.php?session=$session&art=$art_id&kat=$kat&next=$next&page=$page&back=index'><img src='$image' width='$breite' height='$hoehe' border='0'></a></td></tr>
<tr><td id='space' height=2> </td></tr>
<tr><td><a href='details.php?session=$session&art=$art_id&kat=$kat&next=$next&page=$page&back=index'><img src='img/bt-detailsind.png' width='164' height='23' border='0'></a></td></tr>
</table>
</td>");
if ($y!=3) {
print ("<td width=9 id='space'> </td>");
}
}
$y++;
}
print ("</tr>");
}
Wahrscheinlich sind gerade mal die ersten 8 Zeilen relevant, aber vorsichtshalber habe ich die komplette if Abfrage gepostet.
Mithilfe des Codes werden 3 Images aufgerufen, die nebeneinander angezeigt werden. Ich werde die Zahl der Images auf 4 erweitern und möchte diese dann in 2 Reihen nebeneinander anzeigen lassen. Also erste Reihe 2 Bilder. Zweite Reihe 2 Bilder.
Wenn ich echo "<tr>"; im Code einfüge, erreiche ich zumindest schon mal, dass alle Images untereinander gezeigt werden. Aber ganz so will ich das ja nicht. :)
PHP-Code:
if ($z1_artikel!='0') {
print ("<table>");
$sql2_topartikel = "SELECT * FROM topartikel ORDER by top_id";
$res2_topartikel = mysql_query($sql2_topartikel);
while($row = mysql_fetch_assoc($res2_topartikel)) {
$top_id = $row['top_id']; $top_artid = $row['top_artid'];
$sql2_artikel = "SELECT * FROM artikel WHERE art_id = '$top_artid'";
$res2_artikel = mysql_query($sql2_artikel);
echo "<tr>";
while($row = mysql_fetch_assoc($res2_artikel)) {
Hilfe. Bitte!