| | |
pagination problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Solved Threads: 0
I have a problem of pagination of turns out you of one query of search on a DB MySQL. With this code I succeed to visualize the first 5 records out to you in one page but when go in the successive pages it makes to see the first 5 records me of mine database. This is the code:
PHP Syntax (Toggle Plain Text)
<?php $db_host="...."; $db_user="...."; $db_password="..."; $db_database="..."; $c or die ("Errore nella connessione al Mysql:" . mysql_error()); mysql_select_db($db_database,$connessione) or die ("Errore nella selezione del db:" . mysql_error()); $numero_record = 5; if(!isset($HTTP_GET_VARS["inizio"])){ $inizio = 0; }else{ $inizio = $HTTP_GET_VARS["inizio"]; } $query_limit="SELECT AnnoRipresa, Id, FROM table_name WHERE AnnoRipresa LIKE '%$_POST[AnnoRipresa]%' order by Id limit $inizio, $numero_record" or die ("Errore :" . mysql_error());; $query = mysql_query($query_limit); $select = "SELECT AnnoRipresa, Id, FROM table_name WHERE AnnoRipresa LIKE '%$_POST[AnnoRipresa]%'"; $query2 = mysql_query($select); $numero_record_totali = mysql_numrows($query2); $numero_pagine = ceil($numero_record_totali/$numero_record); $pagina_corrente = ceil(($inizio/$numero_record) + 1); while($riga=mysql_fetch_array($query)) {?> <tr> <td colspan="2"> <?php echo <tr> <td height="22" width="20%"><h4><b>Anno Ripresa</b></td> echo "<td>" . $riga['Id'] . "</td>"; echo "</tr>"; } if($numero_pagine > 1){ for($pagina = 1; $pagina <= $numero_pagine; $pagina++){ if($pagina == $pagina_corrente){ ?> <b><?=$pagina?></b> <?php }else{ ?> <a href="fotografie_aeree_verticali.php?inizio=<?=(($pagina - 1) * $numero_record)?>"><?=$pagina?></a> <?php } } } ?>
have you tried the PEAR
ager package? It is really easy to use and is debugged for you. There are also plenty of other packages around, try phpclasses.org as well.
ager package? It is really easy to use and is debugged for you. There are also plenty of other packages around, try phpclasses.org as well. Last edited by sn4rf3r; Oct 30th, 2006 at 12:26 pm. Reason: fixed link
![]() |
Similar Threads
- Problem with Windows Update and WinXP (Web Browsers)
- Store multiple selection from pagination info into single array (PHP)
- pagination and search (PHP)
- commenting system and pagination issue : commenting with filw system storage (PHP)
- PHP Search pagination problem (PHP)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Connection Problems (Networking Hardware Configuration)
Other Threads in the PHP Forum
- Previous Thread: Storing dynamic form values in Arrays for display & insert
- Next Thread: PHP converter
| Thread Tools | Search this Thread |
301 access apache api array autocomplete beginner binary broken button cakephp checkbox class cms code compression cron curl data database date display dropdown dropdownlist duplicates dynamic echo email error execution file files folder form forms function functions google href htaccess html htmlspecialchars httppost image include insert integration ip javascript joomla jquery limit link links login mail md5 menu methods mlm multiple mysql oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote script search secure server session sessions sms source space sql subscription syntax system table tutorial update upload url validator variable video virus volume votedown web youtube





