Einzelnen Beitrag anzeigen
  #7  
Alt 19.12.2011, 20:18:36
Sin84 Sin84 ist offline
Anfänger
 
Registriert seit: Sep 2011
Alter: 40
Beiträge: 9
AW: Tabelle: Eine Variable?, 2 Zeilen

Danke. Jetzt werden immerhin schon mal die Images angezeigt!

Es geht eigentlich um 2 Tabellen, in denen Images untergebracht sind. Ich habe bisher immer nur den Code der ersten gepostet.

Leider werden die Images immer noch falsch angezeigt.

Ich wollte die Images ja so anordnen:

Image1 Image2
Image3 Image4

Leider werden sie in Tabelle 1 jetzt untereinander angeordnet:

Image1
Image2
Image3
Image4

In Tabelle 2 wird in jeder Reihe das Image 4 Mal angezeigt. also:

Image1 Image1 Image1 Image1
Image2 Image2 Image2 Image2
Image3 Image3 Image3 Image3
Image4 Image4 Image4 Image4


Hier nochmal Code:

PHP-Code:
if ($z1_artikel!='0') {
print (
"<td>");
$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 "331";    $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));
}
}


$cols 2# Anzahl der Spalten
$d = new mysqli(hostuserpassdbname);

$r $d->query("SELECT * FROM artikel WHERE art_id = '$top_artid'");

$f 0# Feldzähler

echo '<table><tr>';
while(
$row $r->fetch_assoc()){
  
$f++;
  if (! 
$f $cols)
    echo 
'</tr><tr>';
  echo 
'<td>';
  echo (
"<td width=351>
<table width=351 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>&nbsp;</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>"
); # Ausgabe des img Tags  <-- FALSCH #Tabelle 1
  
echo '</td>';
}
echo 
'</tr></table>'

if (
false !== ($r $d->query("SELECT * FROM artikel WHERE art_id = '$top_artid'"))){ 
  while(
$row $r->fetch_assoc()){ 
   
  } 
}else{ 
  
printf("Errormessage: %s<br />"$d->error); 
}  


if (
$y!=3) {
print (
"<td width=9 id='space'>&nbsp;</td>");
}
}
$y++;
}
print (
"</tr>");

}
else {
print (
"<tr><td>Wir haben leider noch keine Artikel im Angebot!</td></tr>");
}
print (
"</table>
</td></tr>
</table>
</td></tr>

<tr><td id='space' height=10>&nbsp;</td></tr>
<tr><td id='tabrighthead'>Ganz neu im Sortiment</td></tr>
<tr><td id='space' height=10>&nbsp;</td></tr>
<tr><td>
<table id='tabiright' align=center border=0 cellpadding=0 cellspacing=0>
<tr><td id='conth100' valign=top>
<table id='content' align=center border=0 cellpadding=0 cellspacing=0>"
);
$sql1_artikel "SELECT * FROM artikel";
$res1_artikel mysql_query($sql1_artikel);
$z1_artikel mysql_num_rows($res1_artikel);
$x=1;
if (
$z1_artikel!='0') {
print (
"<td>");
$sql2_artikel "SELECT * FROM artikel ORDER by art_id DESC limit 0,4";
$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 "331";    $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));
}
}


$cols 2# Anzahl der Spalten
$d = new mysqli(hostuserpassdbname);

$r $d->query("SELECT * FROM artikel ORDER by art_id DESC limit 0,4");

$f 0# Feldzähler

echo '<table><tr>';
while(
$row $r->fetch_assoc()){
  
$f++;
  if (! 
$f $cols)
    echo 
'</tr><tr>';
  echo 
'<td>';
  echo (
"<td width=351>
<table width=351 border=0 cellpadding=0 cellspacing=0>
<tr><td 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>&nbsp;</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>"
); # Ausgabe des img Tags  <-- FALSCH #Tabelle2
  
echo '</td>';
}
echo 
'</tr></table>'

if (
false !== ($r $d->query("SELECT * FROM artikel ORDER by art_id DESC limit 0,4"))){ 
  while(
$row $r->fetch_assoc()){ 
   
  } 
}else{ 
  
printf("Errormessage: %s<br />"$d->error); 
}  


if (
$x!=3) { 
Ich hoffe du wirst aus dem ganzen Code schlau und bist nochmal so nett, mir zu helfen.
Mit Zitat antworten