Zur Navigation

Tabellen nebeneinander [2]

11 Peter

Richtig, nur reagiert die php-Abfrage sehr merkwürdig, wenn ich innerhalb der Schleife mit <Table> arbeite.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
table {
float:left;
width:200px;
}
</style>
</head>
<body>

<?php
   include "connect.inc.php";
   $res = mysql_query("select * from jalou");
   

   // Tabellenbeginn
   echo "<table border >";
/*   $lf = 1;*/

   while ($dsatz = mysql_fetch_assoc($res))
   {
  
      echo "<td>$lf</td>";
      echo "<tr>";
      echo "<td>" . $dsatz["breite"] . " Breite</td>";
      echo "<td>..</td>";
      echo "<td>PG0</td>";
      echo "<td>PG1</td>";
      echo "<td>PG2</td>";
      echo "<td>PG3</td>";      
      echo "<tr>";      
      echo "<td>hoch</td>";
      echo "<td>80</td>";
      echo "<td>" . $dsatz["h80"] . "</td>";
      echo "<td>" . $dsatz["h81"] . "</td>";
      echo "<td>" . $dsatz["h82"] . "</td>";      
      echo "<td>" . $dsatz["h83"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>90</td>";
      echo "<td>" . $dsatz["h90"] . "</td>";
      echo "<td>" . $dsatz["h91"] . "</td>";
      echo "<td>" . $dsatz["h92"] . "</td>";      
      echo "<td>" . $dsatz["h93"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>100</td>";
      echo "<td>" . $dsatz["h100"] . "</td>";
      echo "<td>" . $dsatz["h101"] . "</td>";
      echo "<td>" . $dsatz["h102"] . "</td>";      
      echo "<td>" . $dsatz["h103"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>110</td>";
      echo "<td>" . $dsatz["h110"] . "</tr>";
      echo "<td>" . $dsatz["h111"] . "</td>";
      echo "<td>" . $dsatz["h112"] . "</td>";      
      echo "<td>" . $dsatz["h113"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>120</td>";
      echo "<td>" . $dsatz["h120"] . "</td>";
      echo "<td>" . $dsatz["h121"] . "</td>";
      echo "<td>" . $dsatz["h122"] . "</td>";      
      echo "<td>" . $dsatz["h123"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>130</td>";
      echo "<td>" . $dsatz["h130"] . "</td>";
      echo "<td>" . $dsatz["h131"] . "</td>";
      echo "<td>" . $dsatz["h132"] . "</td>";      
      echo "<td>" . $dsatz["h133"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>140</td>";
      echo "<td>" . $dsatz["h140"] . "</td>";
      echo "<td>" . $dsatz["h141"] . "</td>";
      echo "<td>" . $dsatz["h142"] . "</td>";      
      echo "<td>" . $dsatz["h143"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>150</td>";
      echo "<td>" . $dsatz["h150"] . "</td>";
      echo "<td>" . $dsatz["h151"] . "</td>";
      echo "<td>" . $dsatz["h152"] . "</td>";      
      echo "<td>" . $dsatz["h153"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>160</td>";
      echo "<td>" . $dsatz["h160"] . "</td>";
      echo "<td>" . $dsatz["h161"] . "</td>";
      echo "<td>" . $dsatz["h162"] . "</td>";      
      echo "<td>" . $dsatz["h163"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>170</td>";
      echo "<td>" . $dsatz["h170"] . "</td>";
      echo "<td>" . $dsatz["h171"] . "</td>";
      echo "<td>" . $dsatz["h172"] . "</td>";      
      echo "<td>" . $dsatz["h173"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>180</td>";
      echo "<td>" . $dsatz["h180"] . "</td>";
      echo "<td>" . $dsatz["h181"] . "</td>";
      echo "<td>" . $dsatz["h182"] . "</td>";      
      echo "<td>" . $dsatz["h183"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>190</td>";
      echo "<td>" . $dsatz["h190"] . "</td>";
      echo "<td>" . $dsatz["h191"] . "</td>";
      echo "<td>" . $dsatz["h192"] . "</td>";      
      echo "<td>" . $dsatz["h193"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>200</td>";
      echo "<td>" . $dsatz["h200"] . "</td>";
      echo "<td>" . $dsatz["h201"] . "</td>";
      echo "<td>" . $dsatz["h202"] . "</td>";      
      echo "<td>" . $dsatz["h203"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>210</td>";
      echo "<td>" . $dsatz["h210"] . "</td>";
      echo "<td>" . $dsatz["h211"] . "</td>";
      echo "<td>" . $dsatz["h212"] . "</td>";      
      echo "<td>" . $dsatz["h213"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>220</td>";
      echo "<td>" . $dsatz["h220"] . "</td>";
      echo "<td>" . $dsatz["h221"] . "</td>";
      echo "<td>" . $dsatz["h222"] . "</td>";      
      echo "<td>" . $dsatz["h223"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>230</td>";
      echo "<td>" . $dsatz["h230"] . "</td>";
      echo "<td>" . $dsatz["h231"] . "</td>";
      echo "<td>" . $dsatz["h232"] . "</td>";      
      echo "<td>" . $dsatz["h233"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>240</td>";
      echo "<td>" . $dsatz["h240"] . "</td>";
      echo "<td>" . $dsatz["h241"] . "</td>";
      echo "<td>" . $dsatz["h242"] . "</td>";      
      echo "<td>" . $dsatz["h243"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>250</td>";
      echo "<td>" . $dsatz["h250"] . "</td>";
      echo "<td>" . $dsatz["h251"] . "</td>";
      echo "<td>" . $dsatz["h252"] . "</td>";      
      echo "<td>" . $dsatz["h253"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>260</td>";
      echo "<td>" . $dsatz["h260"] . "</td>";
      echo "<td>" . $dsatz["h261"] . "</td>";
      echo "<td>" . $dsatz["h262"] . "</td>";      
      echo "<td>" . $dsatz["h263"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>270</td>";
      echo "<td>" . $dsatz["h270"] . "</td>";
      echo "<td>" . $dsatz["h271"] . "</td>";
      echo "<td>" . $dsatz["h272"] . "</td>";      
      echo "<td>" . $dsatz["h273"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>280</td>";
      echo "<td>" . $dsatz["h280"] . "</td>";
      echo "<td>" . $dsatz["h281"] . "</td>";
      echo "<td>" . $dsatz["h282"] . "</td>";      
      echo "<td>" . $dsatz["h283"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>290</td>";
      echo "<td>" . $dsatz["h290"] . "</td>";
      echo "<td>" . $dsatz["h291"] . "</td>";
      echo "<td>" . $dsatz["h292"] . "</td>";      
      echo "<td>" . $dsatz["h293"] . "</td>";
      echo "<tr>";
      echo "<td>hoch</td>";
      echo "<td>300</td>";
      echo "<td>" . $dsatz["h300"] . "</td>";
      echo "<td>" . $dsatz["h301"] . "</td>";
      echo "<td>" . $dsatz["h302"] . "</td>";
      echo "<td>" . $dsatz["h303"] . "</td>";
      echo "<tr>";
      
  /*  $lf = $lf + 1;*/
   }

   // Tabellenende
   echo "</table>";
   echo "<table>";
   echo "<tr>";
   echo "<td></td>";
   echo "<td></td>";
   echo "</tr>";
   echo "</table>";

 
?>
<table>
  <tr>
    <td>Feld01</td>
    <td>Feld02</td>
  </tr>
</table>
<table>
  <tr>
    <td>Feld a</td>
    <td>Feld b</td>
  </tr>
</table>
</body>
</html>

23.01.2008 23:56

12 Jörg Kruse

Wo genau möchtest du denn auftrennen?

Du könntest z.B. Tabellenanfang und Tabellenende in die Schleife hineinnehmen:

   while ($dsatz = mysql_fetch_assoc($res))
   {

 // Tabellenbeginn
   echo "<table border >";
/*   $lf = 1;*/

  // Tabellenende
   echo "</table>";
 /*  $lf = $lf + 1;*/
   }

... dann würde bei jedem Schleifenduchlauf eine neue Tabelle erzeugt

24.01.2008 00:23 | geändert: 24.01.2008 00:24

13 Peter

Hallo Jörg,

habe erst garnicht verstanden, das du mir die Lösung schon gezeigt hast. Erst nach mehrere Versuche hatte ich es dann genauso gemacht.
Vielleicht ist das umstellen von GoLive auf Handarbeiten garnicht soschlecht für mich. Nur so bekomme ich die Möglichkeit es Verstehen zumüssen.

Danke für Deine Hilfe, und für die Geduld.

Viele Grüße
Peter

24.01.2008 21:09

Beitrag schreiben (als Gast)

Die Antwort wird nach der Überprüfung durch einen Moderator freigeschaltet.





[BBCode-Hilfe]