Hello, i do a research with a file : recherche.php, i take those variables, too a file anzeigen.php. On anzeigen.php is the query, with the variables that i did on recherche.php.
Now i want do show 10 entrys per site... and it doesnt work..
Maybe you can find the "bug" :
Recherche.php
Code:
mysql_select_db('kpletschet',$connect); // eine Datenbank aus der Verbindung auswählen
$setMark=isset($_GET['cbxMark']);
$setSegment=isset($_GET['cbxSegment']);
$setSprit=isset($_GET['cbxSprit']);
$Senden=isset($_GET['btnSenden']);
$script=basename($_SERVER['PHP_SELF']);
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Recherche</title>
</head>
<body>
<h1>Script zum auswerten der Autotabelle. </h1>
<p>
<? if ($Senden) {
$query=sprintf("SELECT * FROM Autos WHERE 1=1 ");
if (strlen($setMark)>0) {
$Mark=$_GET['cbxMark'];
if (strlen($Mark)>0) {
echo $Mark ." ";
$query=$query."AND `MARK`='".$Mark."'";
}
}
if ($setSegment) {
$Segment=$_GET['cbxSegment'];
if ($Segment>0) {
echo $Segment." ";
$query=$query." AND `SEGMENT`='".$Segment."'";
}
}
if ($setSprit) {
$Sprit=$_GET['cbxSprit'];
if (strlen($Sprit)>0) {
$Sprit;
$query=$query." AND `BENZIN/DIESEL`='".$Sprit."'";
}
}
}
?>
<br />
<br />
</p>
<table width="409" border="1">
<tr>
<td width="129"><div align="center">Autosmarke </div></td>
<td width="140"><div align="center">Segment</div></td>
<td width="125"><div align="center">Sprit</div></td>
</tr>
</table>
<form id="frmRecherche" name="frmRecherche" method="get" action="<?=$script?>"><select name="cbxMark" id="cbxMark" onchange="MM_jumpMenu('parent',this,0)" >
<option value"*">Bitte auswaehlen</option>
<?
// Alle Marken in die Combobox setzen die sich bereits in der Tabelle befinden
$combo=sprintf("SELECT `MARK` FROM Autos where 1=1");
echo $combo;
$rst = mysql_query($combo,$connect);
while ($zeile=mysql_fetch_assoc($rst)) {
if ($test!=$zeile['MARK']){
echo "<option>".$zeile['MARK']." </option>";
$test = $zeile['MARK'];
}
}
?>
</select>
<select name="cbxSegment" id="cbxSegment" onchange="MM_jumpMenu('parent',this,0)">
<option value="0">Bitte auswaehlen</option>
<option value="1">Kleng an Kompakt</option>
<option value="2">Limousine</option>
<option value="3">Break</option>
<option value="4">Coupe</option>
<option value="5">Offroader/SUV</option>
<option value="6">Monospace</option>
<option value="7">Kabrio</option>
<option value="8">Utilitaire</option>
</select>
<select name="cbxSprit" id="cbxSprit" onchange="MM_jumpMenu('parent',this,0)">
<option value"*">Bitte auswaehlen</option>
<option value="B">Benzin</option>
<option value="D")>Diesel</option>
<option value="E">Aerdgas</option>
<option value="BH">Benzin-Hybrid</option>
</select>
<label>
<input type="submit" name="btnSenden" value="Senden" />
</label>
</form>
<? if ($Senden) {
include("anzeigen.php");
} ?>
Anzeigen.php
Code:
mysql_select_db('kpletschet',$connect); // eine Datenbank aus der Verbindung auswählen
$start = 0;
$limit = 10; // Datensätze pro Ausgabeseite
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Anzeigen.php</title>
</head>
<?
echo "<br>"."<br>" ."Abfrage himself :" . "<br>"."<br>";
echo $query."<br>"."<br>";
$rst = mysql_query($query,$connect); // Abfrage ausführen
$total=mysql_num_rows($rst); //Anzahl der Einträge
$start = ($start >= $total) ? $total - $limit : $start;
$query=$query." LIMIT $start, $limit";
echo $query ."<br>"."<br>";
$rst = mysql_query($query,$connect); // Abfrage ausführen
echo $Anzahl ." Eintraege gefunden";
?>
<table width="950" border="1">
<tr>
<td width="100">MARKE</td>
<td width="100">MODELL</td>
<td width="100">KAROSSERIE</td>
<td width="100">MOTOR/UNDRIFF</td>
<td width="100">FINITIOUN</td>
<td width="100">PRAIS</td>
<td width="100">SEGMENT</td>
<td width="100">BENZIN/DIESEL</td>
<td width="100">AKTUALISIERT</td>
</tr>
<?
while ($zeile=mysql_fetch_array($rst)) {
?> <tr>
<?
//Anzeigen der query in der Tabelle
for ($i=0;$i<=8;$i++)
echo "<td>'$zeile[$i]'</td>";
?> </tr>
<?php
// Zurück- und Vorblättern
if ($start > 0)
{
$newStart = ($start - $limit < 0) ? 0 : ($start-$limit);
echo "<a href=".$_SERVER['PHP_SELF']."?start=".$newStart
."><< zurück</a>";
}
if ($start + $limit < $total)
{
$newStart = $start + $limit;
echo " <a href=".$_SERVER['PHP_SELF']."?start=".$newStart
.">vor >></a>";
}
} //fetch_assoc
?>