$host="localhost"; $user="admin"; $password="my_db_passwd";$my_query = "select a.vorname, a.nachname, v.name, v.ort"; $my_query .= ", b.titel, b.untertitel, b.jahr, b.waehrung"; $my_query .= ", b.preis, b.bild, b.seiten, b.id, b.isbn"; $my_query .= ", rez.vorname, rez.nachname"; $my_query .= ", b.rez_monat, b.rez_jahr"; $my_query .= " from autoren a, buecher b, verlage v, rez_aut r,"; $my_query .= " rezensenten rez where ";
if ($s_autor) { $my_query .= " a.nachname like "; $my_query .= "'%"; $my_query .= $s_autor; $my_query .= "%'"; }
if ($s_autor && ($s_schlag || $s_verlag)) { $my_query .= " and "; }
if ($s_schlag) { $my_query .= " b.titel like "; $my_query .= "'%"; $my_query .= $s_schlag; $my_query .= "%'"; }
if ($s_schlag && $s_verlag) { $my_query .= " and "; }
if ($s_verlag) { $my_query .= " v.name like "; $my_query .= "'%"; $my_query .= $s_verlag; $my_query .= "%'"; }
$my_query .= " and"; $my_query .= " r.buch_id = b.id"; $my_query .= " and"; $my_query .= " a.id = r.autor_id"; $my_query .= " and"; $my_query .= " v.id = b.verlag_id"; $my_query .= " and"; $my_query .= " b.rez_id = rez.id";
$my_query .= " order by a.nachname ";
mysql_connect($host,$user,$password); mysql_select_db("biblio");
$my_res = mysql_query($my_query);
echo "
<table border='2' align='center' cellspacing='0' cellpadding='2'>"; echo "<caption><h1>Suchergebnis für " $s_autor "</h1></caption>\n\n";while ($this_row = mysql_fetch_row($my_res)) { printf("
<tr><td><img src='get_image.php3?ID="); echo $this_row[11]; printf("'></td>"); printf("<td>%s %s<br>\n", $this_row[0], $this_row[1]); printf("<strong>%s</strong><br>\n", $this_row[4]); printf("%s<br>\n", $this_row[5]); printf("%s (%s) %s<br>\n", $this_row[3], $this_row[2], $this_row[6]); printf("%s Seiten<br>", $this_row[10]); printf("ISBN %s<br>", $this_row[12]); printf("%s %s<br>\n", $this_row[7], $this_row[8]); printf("<strong>Rezension:</strong>%s %s \n", $this_row[13], $this_row[14]); printf("in Heft %s/%s</td></tr>\n", $this_row[15], $this_row[16]); } echo "</table>"; mysql_close();
|
| HTML-Ausgabe der MySQL-Anfrage (Abbildung 2) |
Dieser Text ist der Zeitschriften-Ausgabe 06/2000 von iX entnommen.
iOS, Android, Windows Phone 7 und HTML5 - das neue Sonderheft von heise Developer führt Einsteiger und Profis in die Programmierung mobiler Geräte ein.