ein kleines Problem bringt mich um den Verstand.
Bei meiner Abfrage kann ich diese leider nicht sortieren.
- Code: Alles auswählen
if ($send == 1)
{
$datei_handle=fopen("where.txt",w);
if($ort_id)$where=" ort_id='$ort_id'";
if($kategorie)
{
if($where)$where.=" and";
$where.=" kategorie='$kategorie'";
}
if($where)$where=" WHERE".$where;
fwrite($datei_handle,$where);
fclose($datei_handle);
}
?>
<?php //Abfrage nach Anzahl gefundener Datensätze
$takefile=file("where.txt");
$wherefromfile = $takefile[0];
$anzahl_suche = "SELECT id FROM table".$wherefromfile;
$ergebnis = mysql_query($anzahl_suche);
$anzahl_eintrag = mysql_num_rows($ergebnis);
?>
<?php //Abfrage der ausgewählten Suche
if(isset($_POST))
{
$table = "table"; // Der Name der Datenbanktabelle:
$start = (isset($start)) ? abs((int)$start) : 0;
$limit = 25 // Datensätze pro Ausgabeseite25:
$takefile=file("where.txt");
$wherefromfile = $takefile[0];
$resultID = mysql_query("SELECT COUNT(id) FROM ".$table);
$total = mysql_result($resultID,0);
$start = ($start >= $total) ? $total - $limit : $start;
// Datenbankabfrage ausführen.
$query = "SELECT id, ort_id, kategorie, name, adresse, telefon, info, mail, url, url2, pfad, rank, nom FROM table " .$wherefromfile." LIMIT " .$start.",".$limit ;
$result = mysql_query($query);
$anzahl_eintrag = mysql_num_rows($result);
In der where txt speicher ich die abfrage fürs blättern, bei order by einen fehler raus.
- Code: Alles auswählen
// Datenbankabfrage ausführen.
$query = "SELECT id, ort_id, kategorie, name, adresse, telefon, info, mail, url, url2, pfad, rank, nom FROM table order By nom" .$wherefromfile." LIMIT " .$start.",".$limit ;
wenn ich keine auswahl in dem formular anwähle funktioniert es, allerdings wenn ich ein oder die beiden pull-down-menüs auswähle, wirft er mir diesen fehler:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Hat jemenad eine idee??
danke