Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > Databases - MySQL, SQL, Oracle, Access and others
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-03-2006, 05:48 AM   #1 (permalink)
kne
Junior Member
 
Join Date: Apr 2006
Posts: 1
Default problem to show n per site..

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 .">&lt;&lt; zurück</a>"; } if ($start + $limit < $total) { $newStart = $start + $limit; echo " <a href=".$_SERVER['PHP_SELF']."?start=".$newStart .">vor &gt;&gt;</a>"; } } //fetch_assoc ?>

Last edited by kne : 04-03-2006 at 06:53 AM.
kne is offline   Reply With Quote
Sponsored Links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 05:42 AM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums