<?php
$sql1 = mysql_connect ($mysql_server, $mysql_user, $mysql_password) or die ("Keine Verbindung zum Server");
mysql_select_db ($mysql_database) or die ("Keine Verbindung zur Datenbank");
$sql2 = mysql_connect ($mysql_server, $mysql_user, $mysql_password) or die ("Keine Verbindung zum Server");
mysql_select_db ($mysql_database) or die ("Keine Verbindung zur Datenbank");
# $table - > DB-Tabelle
$q1="SELECT id, typ FROM tabelle1 GROUP BY typ ORDER BY typ";
mysql_query($q1, $sql1);
while($res = mysql_fetch_object($sql1)){
$q2= "SELECT * FROM tabelle1 WHERE typ='".$res->typ."'";
mysql_query($q2, $sql2);
echo '<table>';
echo '<tr>';
echo '<td colspan="5">Typ</td>';
echo '</tr>';
echo '<tr>';
echo '<td rowspan="<? echo mysql_num_rows($sql2); ?>">Bild</td>';
echo '</tr>';
while($row = mysql_fetch_object($sql2)){
echo '<tr>';
echo '<td><? echo $row["Bezeichnung"]; ?></td>';
echo '<td><? echo $row["Watt"]; ?></td>';
echo '<td><? echo $row["Sockel"]; ?></td>';
echo '<td><? echo $row["Bestellnummer"]; ?></td>';
echo '</tr>';
}
}
?>
<?php
$sql = mysql_connect ($mysql_server, $mysql_user, $mysql_password) or die ("Keine Verbindung zum Server");
mysql_select_db ($mysql_database) or die ("Keine Verbindung zur Datenbank");
$q1="SELECT id, typ FROM tabelle1 GROUP BY typ ORDER BY typ";
$res_id= mysql_query($q1, $sql);
while($res = mysql_fetch_object($res_id)){
$q2= "SELECT * FROM tabelle1 WHERE typ='".$res->typ."'";
$res_id2 = mysql_query($q2, $sql);
echo '<table>';
echo '<tr>';
echo '<td colspan="5"><? echo $res->typ; ?></td>';
echo '</tr>';
echo '<tr>';
echo '<td rowspan="<? echo mysql_num_rows($res_id2); ?>">Bild</td>';
echo '</tr>';
while($row = mysql_fetch_object($res_id2)){
echo '<tr>';
echo '<td><? echo $row->Bezeichnung; ?></td>';
echo '<td><? echo $row->Watt; ?></td>';
echo '<td><? echo $row->Sockel; ?></td>';
echo '<td><? echo $row->Bestellnummer; ?></td>';
echo '</tr>';
}
}
?>
|
|
|
|
Powered by: Trance Music & vBulletin Forums
|