PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
PHP Blätterfunktion funktioniert plötzlich nicht mehr :-(
Beitrag
<blockquote data-quote="mathi77" data-source="post: 1342478" data-attributes="member: 269794"><p>Hallo Ihr Lieben,</p><p></p><p>bitte um Eure Hilfe, habe meine Firmenabfrage nun mit weiteren Input-Felder ausgebaut und plötzlich funktioniert meine Blätterfunktion nicht mehr <img src="/styles/default/xenforo/smilies/uhm.gif" class="smilie" loading="lazy" alt=":(" title="Frown :(" data-shortname=":(" /> <span style="color: #000000"><span style="color: #FF8000">// SEITEN BLAETTERN AUSGEBEN</span></span></p><p></p><p>Die Url wird aber richtig angezeigt, erst beim erneuten anklicken des Suchbuttons wird die zB. die 2. Seite gezeigt!</p><p></p><p>Habt Ihr einen Tipp? Danke & lg Mathi</p><p></p><p>[php]</p><p><?php </p><p></p><p> // $seite DEFINIEREN</p><p> if(isset($_GET['seite'])){</p><p> $seite=strip_tags($_GET['seite']); // 'BÖSEN' CODE ENTFERNEN (strip_tags)</p><p> $seite=trim($seite); // ÜBERFLÜSSIGE LEERZEICHEN, TABS & CO VOR UND NACH DEM EIGENTLICHEN INHALT ENTFERNEN (trim)</p><p> }</p><p> else {</p><p> $seite=1;</p><p> }</p><p> // $seite DEFINIEREN ENDE</p><p> </p><p> $ZeilenProSeite = 5; // ANZAHL EINTRÄGE PRO SEITE AUS DB</p><p> $start=$seite*$ZeilenProSeite-$ZeilenProSeite; // START FÜR LIMIT ($sql) BERECHENEN </p><p> </p><p> // $suche DEFINIEREN</p><p> if(isset($_POST['s'])){</p><p> $suche=strip_tags($_POST['s']);</p><p> $suche=trim($suche); </p><p> }</p><p> else{</p><p> $suche='';</p><p> // HIER KÖNNTE MAN AUCH EINEN STANDARDWERT FESTLEGEN, ZUM BEISPIEL 'ALLE'</p><p> } </p><p> // $suche DEFINIEREN ENDE</p><p></p><p>?></p><p></p><p> <div id="filter"></p><p> <table cellspacing="0" cellpadding="2" border="0" width="100%"></p><p> <form name="frm" id="frmSuche" method="post" action=""></p><p> <tbody border="1" bordercolor="#E1E1E1"></p><p> <tr></p><p> <td><strong>Firmen</strong></td></p><p> <td colspan="1" align="center"> <a href="eManager.php?page=firmaneu"><img border="0" src="images/neu.gif" alt="neue Firma"/></a><br/></p><p> <a href="eManager.php?page=firmaneu">neue Firma</a></p><p> </td></p><p> </tr></p><p> </p><p> <tr></p><p> <td align="center" colspan="4"></p><p> <input type="submit" value="ALLE" name="s"/></p><p> <input type="submit" value="0-9" name="s"/><br /></p><p> <input type="submit" value="A" name="s"/></p><p> <input type="submit" value="B" name="s"/></p><p> <input type="submit" value="C" name="s"/></p><p> <input type="submit" value="D" name="s"/></p><p> <input type="submit" value="E" name="s"/></p><p> <input type="submit" value="F" name="s"/></p><p> <input type="submit" value="G" name="s"/></p><p> <input type="submit" value="H" name="s"/></p><p> <input type="submit" value="I" name="s"/></p><p> <input type="submit" value="J" name="s"/></p><p> <input type="submit" value="K" name="s"/></p><p> <input type="submit" value="L" name="s"/></p><p> <input type="submit" value="M" name="s"/></p><p> <input type="submit" value="N" name="s"/></p><p> <input type="submit" value="O" name="s"/></p><p> <input type="submit" value="P" name="s"/></p><p> <input type="submit" value="Q" name="s"/></p><p> <input type="submit" value="R" name="s"/></p><p> <input type="submit" value="S" name="s"/></p><p> <input type="submit" value="T" name="s"/></p><p> <input type="submit" value="U" name="s"/></p><p> <input type="submit" value="V" name="s"/></p><p> <input type="submit" value="W" name="s"/></p><p> <input type="submit" value="X" name="s"/></p><p> <input type="submit" value="Y" name="s"/></p><p> <input type="submit" value="Z" name="s"/></p><p> </td></p><p> </tr></p><p> </form></p><p> </p><p> <tr></p><p> <td colspan="3"></p><p> <form id="suchen" method="POST" action=""></p><p> <label for="sucheFirma">Firma:&nbsp;</label><input type="text" value="" name="sucheFirma"/></p><p> <label for="sucheStrasse">Strasse:&nbsp;</label><input type="text" value="" name="sucheStrasse"/></p><p> <label for="suchePLZ">PLZ:&nbsp;</label><input type="text" value="" id="suchePLZ" name="suchePLZ"/></p><p> <label for="sucheOrt">ORT:&nbsp;</label><input type="text" value="" name="sucheOrt"/></p><p> <label for="sucheVorname">Ansprechperson:&nbsp;</label><input type="text" value="" name="sucheVorname"/><input type="text" value="" name="sucheNachname"/></p><p> <select name="verkaeufer" size="1" id="verkaeufer" ></p><p> <option value="0">Verk&auml;ufer</option></p><p> <?php </p><p> $sql = "SELECT id_Benutzer, nachname FROM tbl_benutzerdaten ORDER BY nachname ASC";</p><p> $result = mysql_query($sql) or die("ERROR: ".mysql_error());</p><p> while($data = mysql_fetch_array($result)){</p><p> echo '<option value="'.$data['id_Benutzer'].'">'.$data['nachname'].'</option>';</p><p> }</p><p> ?></p><p> </select></p><p> <input type="submit" value="SUCHE" name="s"/></p><p></p><p> </form> </p><p> </td></p><p> <td align="right"></p><p> </td></p><p> </tr> </p><p></p><p> </tbody></p><p> </table> </p><p> </p><p> <table border="0" cellpadding="0" cellspacing="0"></p><p> <colgroup></p><p> <col width="30" /></p><p> <col width="200" /></p><p> <col width="200" /></p><p> <col width="200" /></p><p> <col width="50" /> </p><p> <col width="100" /></p><p> <col width="100" /></p><p> </colgroup></p><p> <thead></p><p> <tr></p><p> <th scope="col"></th></p><p> <th scope="col">Firma</th></p><p> <th scope="col">Ansprechperson</th></p><p> <th scope="col">Adresse</th></p><p> <th scope="col">PLZ</th></p><p> <th scope="col">Ort</th></p><p> <th scope="col">Telnr</th></p><p> </tr></p><p> </thead></p><p> </p><p> <?php </p><p> if($suche){</p><p> if($suche=='ALLE'){</p><p> $where=''; // ALLE DATENSÄTZE ANZEIGEN</p><p> }</p><p> elseif($suche=='0-9' || preg_match('/^[a-zA-Z]$/', $suche)){</p><p> $suche=strtoupper($suche);</p><p> $where=" WHERE Firma REGEXP '^[" . mysql_real_escape_string($suche) . "]'"; // DATENSÄTZE DIE MIT BUCHSTABE ODER ZAHL AUS $suche BEGINNEN</p><p> }</p><p> else{</p><p> $where=" WHERE Firma LIKE '%" . mysql_real_escape_string($_POST['sucheFirma']) . "%'</p><p> AND faStrasse LIKE '%" . mysql_real_escape_string($_POST['sucheStrasse']) . "%'</p><p> AND faPLZ LIKE '%" . mysql_real_escape_string($_POST['suchePLZ']) . "%'</p><p> AND faOrt LIKE '%" . mysql_real_escape_string($_POST['sucheOrt']) . "%'</p><p> AND faVorname LIKE '%" . mysql_real_escape_string($_POST['sucheVorname']) . "%'</p><p> AND faNachname LIKE '%" . mysql_real_escape_string($_POST['sucheNachname']) . "%'</p><p> ";</p><p> if($_POST['verkaeufer']>0) { $where.= "AND fid_benutzer=".$_POST['verkaeufer'];}</p><p> }</p><p> </p><p> // GESAMTANZAHL ERMITTELN</p><p> $sql = "SELECT COUNT(idFirma) FROM tbl_firmen" . $where;</p><p> $result = mysql_query($sql) or die("ERROR: ".mysql_error());</p><p> $anzahl = mysql_result($result, 0);</p><p> // GESAMTANZAHL ERMITTELN ENDE</p><p> </p><p> if ($anzahl==0){</p><p> echo '<p class="Eintrag">Leider verlief die Suche ohne Erfolg!</p>';</p><p> }</p><p> else{</p><p> if ($anzahl==1){</p><p> echo '<p class="Eintrag">1 Eintrag gefunden</p>';</p><p> }</p><p> else{</p><p> echo '<p class="Eintrag">' . $anzahl . ' Eintr&auml;ge gefunden</p>';</p><p> }</p><p> </p><p> $sql = "SELECT * FROM tbl_firmen" . $where . " ORDER BY Firma LIMIT " . $start . ", " . $ZeilenProSeite;</p><p> $result = mysql_query($sql) or die("ERROR: ".mysql_error());</p><p> if(mysql_num_rows($result)>=1){</p><p> echo '<tbody>';</p><p> $nr=1;</p><p> while($row = mysql_fetch_object($result)){</p><p> if($nr % 2 == 0 ){</p><p> $wert = 'bgFarbe1';</p><p> }</p><p> else{</p><p> $wert = 'bgFarbe2';</p><p> }</p><p> echo '</p><p> <form name="frmAnzeige" id="frmAnzeige" method="GET" action="fa_details.php"></p><p> <tr class="'.$wert.'"></p><p> <td align="center">'.($nr+$start).'</td></p><p> <input type="hidden" name="idFirma" value="'.$row->idFirma.'" /></p><p> <td><a href="' . $_SERVER['PHP_SELF'] . '?page=fa_details&id='.$row->idFirma.'">'.$row->Firma.'</a></td></p><p> <td>'.$row->faVorname.'&nbsp;'.$row->faNachname.'</td></p><p> <td>'.$row->faStrasse.'&nbsp;'.$row->faHausnr.'</td></p><p> <td>'.$row->faPLZ.'</td></p><p> <td>'.$row->faOrt.'</td></p><p> <td>'.$row->faTelVW.'&nbsp;'.$row->faTelNR.'</td></p><p> </tr></p><p> </form></p><p> ';</p><p> $nr++;</p><p> }</p><p> echo '</tbody>';</p><p> }</p><p> else{</p><p> echo '<p class="Eintrag">Seite ' . $seite . ' existiert nicht!</p>';</p><p> }</p><p> </p><p> // SEITEN BLAETTERN AUSGEBEN</p><p> $gesamtseiten=ceil($anzahl/$ZeilenProSeite);</p><p> echo '<p class="link">Seite&nbsp;';</p><p> for($i=1;$i<=$gesamtseiten;$i++){ </p><p> if($i==$seite){</p><p> echo '<b>[' . $i . ']</b>';</p><p> }</p><p> else{</p><p> echo '[<a href="' . $_SERVER['PHP_SELF'] . '?page=firmen&seite=' . $i . '&amp;s=' . $suche . '">' . $i . '</a>]';</p><p> }</p><p> }</p><p> echo '</p>';</p><p> // SEITEN BLAETTERN AUSGEBEN</p><p> }</p><p> }</p><p> else{</p><p> echo '<p class="Eintrag">Bitte geben Sie einen Suchbegriff ein!</p>';</p><p> }</p><p></p><p> ?></p><p> </tbody></p><p> </table></p><p> </p><p> </div><!-- end filter --></p><p>[/php]</p></blockquote><p></p>
[QUOTE="mathi77, post: 1342478, member: 269794"] Hallo Ihr Lieben, bitte um Eure Hilfe, habe meine Firmenabfrage nun mit weiteren Input-Felder ausgebaut und plötzlich funktioniert meine Blätterfunktion nicht mehr :( [COLOR=#000000][COLOR=#FF8000]// SEITEN BLAETTERN AUSGEBEN[/COLOR][/COLOR] Die Url wird aber richtig angezeigt, erst beim erneuten anklicken des Suchbuttons wird die zB. die 2. Seite gezeigt! Habt Ihr einen Tipp? Danke & lg Mathi [php] <?php // $seite DEFINIEREN if(isset($_GET['seite'])){ $seite=strip_tags($_GET['seite']); // 'BÖSEN' CODE ENTFERNEN (strip_tags) $seite=trim($seite); // ÜBERFLÜSSIGE LEERZEICHEN, TABS & CO VOR UND NACH DEM EIGENTLICHEN INHALT ENTFERNEN (trim) } else { $seite=1; } // $seite DEFINIEREN ENDE $ZeilenProSeite = 5; // ANZAHL EINTRÄGE PRO SEITE AUS DB $start=$seite*$ZeilenProSeite-$ZeilenProSeite; // START FÜR LIMIT ($sql) BERECHENEN // $suche DEFINIEREN if(isset($_POST['s'])){ $suche=strip_tags($_POST['s']); $suche=trim($suche); } else{ $suche=''; // HIER KÖNNTE MAN AUCH EINEN STANDARDWERT FESTLEGEN, ZUM BEISPIEL 'ALLE' } // $suche DEFINIEREN ENDE ?> <div id="filter"> <table cellspacing="0" cellpadding="2" border="0" width="100%"> <form name="frm" id="frmSuche" method="post" action=""> <tbody border="1" bordercolor="#E1E1E1"> <tr> <td><strong>Firmen</strong></td> <td colspan="1" align="center"> <a href="eManager.php?page=firmaneu"><img border="0" src="images/neu.gif" alt="neue Firma"/></a><br/> <a href="eManager.php?page=firmaneu">neue Firma</a> </td> </tr> <tr> <td align="center" colspan="4"> <input type="submit" value="ALLE" name="s"/> <input type="submit" value="0-9" name="s"/><br /> <input type="submit" value="A" name="s"/> <input type="submit" value="B" name="s"/> <input type="submit" value="C" name="s"/> <input type="submit" value="D" name="s"/> <input type="submit" value="E" name="s"/> <input type="submit" value="F" name="s"/> <input type="submit" value="G" name="s"/> <input type="submit" value="H" name="s"/> <input type="submit" value="I" name="s"/> <input type="submit" value="J" name="s"/> <input type="submit" value="K" name="s"/> <input type="submit" value="L" name="s"/> <input type="submit" value="M" name="s"/> <input type="submit" value="N" name="s"/> <input type="submit" value="O" name="s"/> <input type="submit" value="P" name="s"/> <input type="submit" value="Q" name="s"/> <input type="submit" value="R" name="s"/> <input type="submit" value="S" name="s"/> <input type="submit" value="T" name="s"/> <input type="submit" value="U" name="s"/> <input type="submit" value="V" name="s"/> <input type="submit" value="W" name="s"/> <input type="submit" value="X" name="s"/> <input type="submit" value="Y" name="s"/> <input type="submit" value="Z" name="s"/> </td> </tr> </form> <tr> <td colspan="3"> <form id="suchen" method="POST" action=""> <label for="sucheFirma">Firma: </label><input type="text" value="" name="sucheFirma"/> <label for="sucheStrasse">Strasse: </label><input type="text" value="" name="sucheStrasse"/> <label for="suchePLZ">PLZ: </label><input type="text" value="" id="suchePLZ" name="suchePLZ"/> <label for="sucheOrt">ORT: </label><input type="text" value="" name="sucheOrt"/> <label for="sucheVorname">Ansprechperson: </label><input type="text" value="" name="sucheVorname"/><input type="text" value="" name="sucheNachname"/> <select name="verkaeufer" size="1" id="verkaeufer" > <option value="0">Verkäufer</option> <?php $sql = "SELECT id_Benutzer, nachname FROM tbl_benutzerdaten ORDER BY nachname ASC"; $result = mysql_query($sql) or die("ERROR: ".mysql_error()); while($data = mysql_fetch_array($result)){ echo '<option value="'.$data['id_Benutzer'].'">'.$data['nachname'].'</option>'; } ?> </select> <input type="submit" value="SUCHE" name="s"/> </form> </td> <td align="right"> </td> </tr> </tbody> </table> <table border="0" cellpadding="0" cellspacing="0"> <colgroup> <col width="30" /> <col width="200" /> <col width="200" /> <col width="200" /> <col width="50" /> <col width="100" /> <col width="100" /> </colgroup> <thead> <tr> <th scope="col"></th> <th scope="col">Firma</th> <th scope="col">Ansprechperson</th> <th scope="col">Adresse</th> <th scope="col">PLZ</th> <th scope="col">Ort</th> <th scope="col">Telnr</th> </tr> </thead> <?php if($suche){ if($suche=='ALLE'){ $where=''; // ALLE DATENSÄTZE ANZEIGEN } elseif($suche=='0-9' || preg_match('/^[a-zA-Z]$/', $suche)){ $suche=strtoupper($suche); $where=" WHERE Firma REGEXP '^[" . mysql_real_escape_string($suche) . "]'"; // DATENSÄTZE DIE MIT BUCHSTABE ODER ZAHL AUS $suche BEGINNEN } else{ $where=" WHERE Firma LIKE '%" . mysql_real_escape_string($_POST['sucheFirma']) . "%' AND faStrasse LIKE '%" . mysql_real_escape_string($_POST['sucheStrasse']) . "%' AND faPLZ LIKE '%" . mysql_real_escape_string($_POST['suchePLZ']) . "%' AND faOrt LIKE '%" . mysql_real_escape_string($_POST['sucheOrt']) . "%' AND faVorname LIKE '%" . mysql_real_escape_string($_POST['sucheVorname']) . "%' AND faNachname LIKE '%" . mysql_real_escape_string($_POST['sucheNachname']) . "%' "; if($_POST['verkaeufer']>0) { $where.= "AND fid_benutzer=".$_POST['verkaeufer'];} } // GESAMTANZAHL ERMITTELN $sql = "SELECT COUNT(idFirma) FROM tbl_firmen" . $where; $result = mysql_query($sql) or die("ERROR: ".mysql_error()); $anzahl = mysql_result($result, 0); // GESAMTANZAHL ERMITTELN ENDE if ($anzahl==0){ echo '<p class="Eintrag">Leider verlief die Suche ohne Erfolg!</p>'; } else{ if ($anzahl==1){ echo '<p class="Eintrag">1 Eintrag gefunden</p>'; } else{ echo '<p class="Eintrag">' . $anzahl . ' Einträge gefunden</p>'; } $sql = "SELECT * FROM tbl_firmen" . $where . " ORDER BY Firma LIMIT " . $start . ", " . $ZeilenProSeite; $result = mysql_query($sql) or die("ERROR: ".mysql_error()); if(mysql_num_rows($result)>=1){ echo '<tbody>'; $nr=1; while($row = mysql_fetch_object($result)){ if($nr % 2 == 0 ){ $wert = 'bgFarbe1'; } else{ $wert = 'bgFarbe2'; } echo ' <form name="frmAnzeige" id="frmAnzeige" method="GET" action="fa_details.php"> <tr class="'.$wert.'"> <td align="center">'.($nr+$start).'</td> <input type="hidden" name="idFirma" value="'.$row->idFirma.'" /> <td><a href="' . $_SERVER['PHP_SELF'] . '?page=fa_details&id='.$row->idFirma.'">'.$row->Firma.'</a></td> <td>'.$row->faVorname.' '.$row->faNachname.'</td> <td>'.$row->faStrasse.' '.$row->faHausnr.'</td> <td>'.$row->faPLZ.'</td> <td>'.$row->faOrt.'</td> <td>'.$row->faTelVW.' '.$row->faTelNR.'</td> </tr> </form> '; $nr++; } echo '</tbody>'; } else{ echo '<p class="Eintrag">Seite ' . $seite . ' existiert nicht!</p>'; } // SEITEN BLAETTERN AUSGEBEN $gesamtseiten=ceil($anzahl/$ZeilenProSeite); echo '<p class="link">Seite '; for($i=1;$i<=$gesamtseiten;$i++){ if($i==$seite){ echo '<b>[' . $i . ']</b>'; } else{ echo '[<a href="' . $_SERVER['PHP_SELF'] . '?page=firmen&seite=' . $i . '&s=' . $suche . '">' . $i . '</a>]'; } } echo '</p>'; // SEITEN BLAETTERN AUSGEBEN } } else{ echo '<p class="Eintrag">Bitte geben Sie einen Suchbegriff ein!</p>'; } ?> </tbody> </table> </div><!-- end filter --> [/php] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 5, ▼ = 2 und ■ = 7, was ist ▲ × ▼ + ■?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
PHP Blätterfunktion funktioniert plötzlich nicht mehr :-(
Oben