Hallo,
habe eine Abfrage aus 2 Tabellen erswtellt. Funktioniert, jedoch nur ohne Sortierung mit order by.
Hier der Quelltext mit order by. Kann mir da jemand helfen? Danke.
html>
<head>
<title>xxx</title>
</head>
<body>
<h2>*** Tabellenbeschriftung ***</h2>
<?php
require_once "../id_db.php";
$abfrage = "SELECT T1.VERBINDUNG, T2.Nachname, T2.Vorname, T2.Status FROM T1, T2
order by T2.Vorname asc
where T1.ID = T2.ID and (T1.VERB_TYP = 4 or T1.VERB_TYP = 1001)
and (T2.status=1 or T2.status=2 or T2.status=3 or T2.status=5 or T2.status=6)"
;
$ergebnis = mysql_query($abfrage)
OR die("Error: $abfrage <br>".mysql_error());
echo "<table width=\"400px\" border=\"2\">";
echo "<tr>";
echo "<td width=\"200px\"><span style='font-family:Arial, Verdana; font-size:15px; color:#0000FF;'><b>Nachname</b></span></td>";
echo "<td width=\"150px\"><span style='font-family:Arial, Verdana; font-size:15px; color:#0000FF;'><b>Vorname</b></span></td>";
echo "<td width=\"50px\"><span style='font-family:Arial, Verdana; font-size:15px; color:#0000FF;'><b>Status</b></span></td>";
echo "</tr>";
while($row = mysql_fetch_object($ergebnis))
{
$nname = "$row->Nachname, $row->Vorname";
$vname = $row->Vorname;
$VERBINDUNG = $row->VERBINDUNG;
echo "<tr>";
echo "<td><span style='font-family:Arial, Verdana; font-size:10px; color:#0000FF;'>" . $nname . "</span></td>";
echo "<td><span style='font-family:Arial, Verdana; font-size:10px; color:#0000FF;'>" . $vname . "</span></td>";
echo "<td><span style='font-family:Arial, Verdana; font-size:10px; color:#0000FF;'>" . $VERBINDUNG . "</span></td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
</body>
</html>
habe eine Abfrage aus 2 Tabellen erswtellt. Funktioniert, jedoch nur ohne Sortierung mit order by.
Hier der Quelltext mit order by. Kann mir da jemand helfen? Danke.

html>
<head>
<title>xxx</title>
</head>
<body>
<h2>*** Tabellenbeschriftung ***</h2>
<?php
require_once "../id_db.php";
$abfrage = "SELECT T1.VERBINDUNG, T2.Nachname, T2.Vorname, T2.Status FROM T1, T2
order by T2.Vorname asc
where T1.ID = T2.ID and (T1.VERB_TYP = 4 or T1.VERB_TYP = 1001)
and (T2.status=1 or T2.status=2 or T2.status=3 or T2.status=5 or T2.status=6)"
;
$ergebnis = mysql_query($abfrage)
OR die("Error: $abfrage <br>".mysql_error());
echo "<table width=\"400px\" border=\"2\">";
echo "<tr>";
echo "<td width=\"200px\"><span style='font-family:Arial, Verdana; font-size:15px; color:#0000FF;'><b>Nachname</b></span></td>";
echo "<td width=\"150px\"><span style='font-family:Arial, Verdana; font-size:15px; color:#0000FF;'><b>Vorname</b></span></td>";
echo "<td width=\"50px\"><span style='font-family:Arial, Verdana; font-size:15px; color:#0000FF;'><b>Status</b></span></td>";
echo "</tr>";
while($row = mysql_fetch_object($ergebnis))
{
$nname = "$row->Nachname, $row->Vorname";
$vname = $row->Vorname;
$VERBINDUNG = $row->VERBINDUNG;
echo "<tr>";
echo "<td><span style='font-family:Arial, Verdana; font-size:10px; color:#0000FF;'>" . $nname . "</span></td>";
echo "<td><span style='font-family:Arial, Verdana; font-size:10px; color:#0000FF;'>" . $vname . "</span></td>";
echo "<td><span style='font-family:Arial, Verdana; font-size:10px; color:#0000FF;'>" . $VERBINDUNG . "</span></td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
</body>
</html>
Kommentar