Hi,
ich habe eine Datenbank mit Filmen, alles klappt ->Ausgabe, suchen, einfügen und ändern und sortieren auch. Bloß das sortiern klappt nur in eine richtung und zwar von A-Z, von Z-A leider nicht. Ich weiß das man mit ASC z.b bei SELECT * FROM $movietab ORDER BY titel ASC von A-Z sortieren läßt und mit DESC andersrum, doch habe ich keinen Plan wie ich das in mein Script einbauen soll. Man soll über einen Link jeweils von A-Z und von Z-A sortieren lassen können. Könnt ihr mir weiterhelfen?
Das ist das Script mit sortiern von A-Z::::
<html>
<head>
<title>sortieren der Filme</title>
</head>
<link type="text/css" rel="stylesheet" href="../../webstyle.css">
<body>
<p align="left"><b><font size="4" color="#0099FF" face="Verdana">>>movie Datenbank</font></b>
<?
include("../../config.php");
$db = mysql_connect($server,$user,$pass);
$res = mysql_db_query($dbase, "select * from $movietab");
$num = mysql_num_rows($res);
$result = mysql_query("SELECT COUNT(*) as zahl FROM $movietab");
$ausgabe = mysql_fetch_array($result);
echo"<font size='1'>Filme insgesamt <b>$ausgabe[zahl]</b></font>";
?>
<br>
<br>
Suchen:::
<br>
<br>
<form action = "search.php" method = "post">
<INPUT TYPE="text" NAME="find" SIZE=20 MAXLENGTH=50>
<input type = "submit" value="suchen"><input type = "reset" value="reset">
</form>
<table border="0" width="100%">
<tr>
<td width="33%"> </td>
<td width="34%"><p align="center"><a href="file://///Server/C/xampp/htdocs/db/movie/admin" style="Background-Color:#20548B; text-decoration: none" target="_blank"><font face="Verdana"color="#FFFFFF" size="1">Admin Panel</font></a></p></td>
<td width="33%"> </td>
</tr>
</table>
<font size="1">
<table border="0">
<?
include("../../config.php");
$verbindung = mysql_connect ($server, $user, $pass) OR DIE ("Unable to connect to database");
mysql_select_db($dbase,$verbindung) OR DIE ("Unable to connect to database");
echo "<tr><td width='35%' height'461'><table width='100%' border='0' bordercolor=#0099FF>
<tr>
<td><b><a href=\"$PHP_SELF?type=id\">id</a</b></td>
<td><b><a href=\"$PHP_SELF?type=titel\">Titel</a></b></td>
<td><b><a href=\"$PHP_SELF?type=genre\">Genre</a></b></td>
<td><b><a href=\"$PHP_SELF?type=format\">Format</a></b></td>
<td><b><a href=\"$PHP_SELF?type=cd\">Cd-Anzahl</a></b></td>
<td><b><a href=\"$PHP_SELF?type=bes\">Extras</a></b></td>
<td><b><a href=\"$PHP_SELF?type=url\">www</a></b></td>
<td><b><a href=\"$PHP_SELF?type=quelle\">Quelle</a></b></td>
<td><b><a href=\"$PHP_SELF?type=sys\">Videosystem</a></b></td>
</tr>";
//--------------------------------sortieren nach id----------------------------------------//
if ($type == "id")
{
$abfrage = "SELECT * FROM $movietab ORDER BY id ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Titel----------------------------------------//
if ($type == "titel")
{
$abfrage = "SELECT * FROM $movietab ORDER BY titel ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Genre----------------------------------------//
if ($type == "genre")
{
$abfrage = "SELECT * FROM $movietab ORDER BY genre ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Format----------------------------------------//
if ($type == "format")
{
$abfrage = "SELECT * FROM $movietab ORDER BY format ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach CD-Anzahl----------------------------------------//
if ($type == "cd")
{
$abfrage = "SELECT * FROM $movietab ORDER BY cd ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Extras----------------------------------------//
if ($type == "bes")
{
$abfrage = "SELECT * FROM $movietab ORDER BY bes ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach www----------------------------------------//
if ($type == "url")
{
$abfrage = "SELECT * FROM $movietab ORDER BY url ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Quelle----------------------------------------//
if ($type == "quelle")
{
$abfrage = "SELECT * FROM $movietab ORDER BY quelle ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Videosystem----------------------------------------//
if ($type == "sys")
{
$abfrage = "SELECT * FROM $movietab ORDER BY sys ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
mysql_close($verbindung);
?>
</table>
</body>
</html>
Danke im voraus!!!
ich habe eine Datenbank mit Filmen, alles klappt ->Ausgabe, suchen, einfügen und ändern und sortieren auch. Bloß das sortiern klappt nur in eine richtung und zwar von A-Z, von Z-A leider nicht. Ich weiß das man mit ASC z.b bei SELECT * FROM $movietab ORDER BY titel ASC von A-Z sortieren läßt und mit DESC andersrum, doch habe ich keinen Plan wie ich das in mein Script einbauen soll. Man soll über einen Link jeweils von A-Z und von Z-A sortieren lassen können. Könnt ihr mir weiterhelfen?
Das ist das Script mit sortiern von A-Z::::
<html>
<head>
<title>sortieren der Filme</title>
</head>
<link type="text/css" rel="stylesheet" href="../../webstyle.css">
<body>
<p align="left"><b><font size="4" color="#0099FF" face="Verdana">>>movie Datenbank</font></b>
<?
include("../../config.php");
$db = mysql_connect($server,$user,$pass);
$res = mysql_db_query($dbase, "select * from $movietab");
$num = mysql_num_rows($res);
$result = mysql_query("SELECT COUNT(*) as zahl FROM $movietab");
$ausgabe = mysql_fetch_array($result);
echo"<font size='1'>Filme insgesamt <b>$ausgabe[zahl]</b></font>";
?>
<br>
<br>
Suchen:::
<br>
<br>
<form action = "search.php" method = "post">
<INPUT TYPE="text" NAME="find" SIZE=20 MAXLENGTH=50>
<input type = "submit" value="suchen"><input type = "reset" value="reset">
</form>
<table border="0" width="100%">
<tr>
<td width="33%"> </td>
<td width="34%"><p align="center"><a href="file://///Server/C/xampp/htdocs/db/movie/admin" style="Background-Color:#20548B; text-decoration: none" target="_blank"><font face="Verdana"color="#FFFFFF" size="1">Admin Panel</font></a></p></td>
<td width="33%"> </td>
</tr>
</table>
<font size="1">
<table border="0">
<?
include("../../config.php");
$verbindung = mysql_connect ($server, $user, $pass) OR DIE ("Unable to connect to database");
mysql_select_db($dbase,$verbindung) OR DIE ("Unable to connect to database");
echo "<tr><td width='35%' height'461'><table width='100%' border='0' bordercolor=#0099FF>
<tr>
<td><b><a href=\"$PHP_SELF?type=id\">id</a</b></td>
<td><b><a href=\"$PHP_SELF?type=titel\">Titel</a></b></td>
<td><b><a href=\"$PHP_SELF?type=genre\">Genre</a></b></td>
<td><b><a href=\"$PHP_SELF?type=format\">Format</a></b></td>
<td><b><a href=\"$PHP_SELF?type=cd\">Cd-Anzahl</a></b></td>
<td><b><a href=\"$PHP_SELF?type=bes\">Extras</a></b></td>
<td><b><a href=\"$PHP_SELF?type=url\">www</a></b></td>
<td><b><a href=\"$PHP_SELF?type=quelle\">Quelle</a></b></td>
<td><b><a href=\"$PHP_SELF?type=sys\">Videosystem</a></b></td>
</tr>";
//--------------------------------sortieren nach id----------------------------------------//
if ($type == "id")
{
$abfrage = "SELECT * FROM $movietab ORDER BY id ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Titel----------------------------------------//
if ($type == "titel")
{
$abfrage = "SELECT * FROM $movietab ORDER BY titel ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Genre----------------------------------------//
if ($type == "genre")
{
$abfrage = "SELECT * FROM $movietab ORDER BY genre ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Format----------------------------------------//
if ($type == "format")
{
$abfrage = "SELECT * FROM $movietab ORDER BY format ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach CD-Anzahl----------------------------------------//
if ($type == "cd")
{
$abfrage = "SELECT * FROM $movietab ORDER BY cd ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Extras----------------------------------------//
if ($type == "bes")
{
$abfrage = "SELECT * FROM $movietab ORDER BY bes ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach www----------------------------------------//
if ($type == "url")
{
$abfrage = "SELECT * FROM $movietab ORDER BY url ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Quelle----------------------------------------//
if ($type == "quelle")
{
$abfrage = "SELECT * FROM $movietab ORDER BY quelle ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
//--------------------------------sortieren nach Videosystem----------------------------------------//
if ($type == "sys")
{
$abfrage = "SELECT * FROM $movietab ORDER BY sys ASC";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$i = $row->id;
$t = $row->titel;
$g = $row->genre;
$f = $row->format;
$c = $row->cd;
$b = $row->bes;
$w = $row->url;
$q = $row->quelle;
$s = $row->sys;
echo "<tr>
<td>$i</td>
<td>$t</td>
<td>$g</td>
<td>$f</td>
<td>$c</td>
<td>$b</td>
<td><a href='http://$u' target='_blank'>$u</a></td>
<td>$q</td>
<td>$s</td></td>
</tr>";
}
}
mysql_close($verbindung);
?>
</table>
</body>
</html>
Danke im voraus!!!
Kommentar