Ich habe folgendes Suchscript. In einem Formular kann ich in einem Textfeld ein oder mehrere Suchbegriffe eingeben und mittels Kontrollkästchen die Felder, in denen gesucht werden soll, auswählen. Die Suche funktioniert, solange ich nur ein Feld auswähle, aber sobald ich zwei Felder auswähle, bekomme ich den Fehler
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /u/www/php/orbabyl8/Suche.php on line 34
Woran kann das liegen. Ich bin Laie und hoffe, mir kann hier jemand helfen.
Danke schon im voraus. Ach ja, folgend der Code.
Dareios
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /u/www/php/orbabyl8/Suche.php on line 34
Woran kann das liegen. Ich bin Laie und hoffe, mir kann hier jemand helfen.
Danke schon im voraus. Ach ja, folgend der Code.
Dareios
Code:
<? "Content-type: text/html\n\n"; "'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">'", "\n"; "<html><head>\n"; echo "<title>Suchergebnis</title></head>\n"; $link = mysql_pconnect("XXX","XXX","XXX"); mysql_select_db("XXX",$link); $Suche = explode(" ", $_POST[Suche]); $i = 1; foreach($_POST['seite'] as $value) { foreach($Suche as $anfrageteil) { $anfrage .= " ".$value." LIKE '%".$anfrageteil."%' "; if($i < count($Suche)) $anfrage .= "AND"; $i++; } } $query = "SELECT * FROM Biblmes WHERE".$anfrage; $result = mysql_query($query, $link); while($row = mysql_fetch_array($result)) { if (empty($row[Zitat])) { echo "$row[Autor] $row[Titel] $row[Buchdaten]. "; } if (empty($row[Buchdaten])) { echo "$row[Autor] $row[Titel] $row[Zitat]. "; } } ?>
Kommentar