Paginacija...problem.

Paginacija...problem.

offline
  • Pridružio: 26 Feb 2010
  • Poruke: 109

Nasao skriptu na netu za paginaciju ali nece da radi... U tabeli "oglas" imam unete 13 kolone koje treba da se izcitaju... Ne vidim u cemu je problem, kada pokrenem skriptu na prvoj strani mi prikaze sve 13 kolone iz tabele, takodje i na stranici 2 potpuno isto...

<?php include('db.php'); ?> <link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" /> <table class="topsite" cellpadding="0" cellspacing="0">    <tr>        <th class="ranking_th">Ranking</th>        <th class="site_th">Site</th>        <th class="votes_th">Votes</th>     </tr> <?php //We get the number of websites $req1 = mysql_fetch_array(mysql_query('SELECT count(`oglas_id`) AS nb FROM `oglas`')); $nb_site_page = 10; //We get the current page if(isset($_GET['page'])) {    $page = intval($_GET['page']); } else {    $page = 1; } //We calculate the number of pages and we display pages links $nbpages = ceil($req1['nb']/$nb_site_page); if($page<1 or $page>$nbpages) {    $page = 1; } $pages_site = 'Pages: '; if($page>1) {    $pages_site .= '<a href="?page='.($page-1).'">Previous</a> '; } for($i=1;$i<=$nbpages;$i++) {    if($i==$page)    {       $pages_site .= '<strong>'.$i.'</strong> ';    }    else    {       $pages_site .= '<a href="?page='.$i.'">'.$i.'</a> ';    } } if($page<$nbpages) {    $pages_site .= '<a href="?page='.($page+1).'">Next</a>'; } ?>     <tr>        <td colspan="3" class="pages"><?php echo $pages_site; ?></td>     </tr> <?php //We calculate the first and last message position to display $first_message = ($page-1)*$nb_site_page; $last_message = $first_message +$nb_site_page; $i = $first_message ; //On affiche les sites $req2 = mysql_query("SELECT * FROM `oglas`"); while($dnn2 = mysql_fetch_array($req2)) {    $i++; ?>    <tr>        <td class="ranking"><?php echo $i; ?>       </td>        <td class="site"><?php echo $dnn2['oglas_naslov']; ?></a><br />       <?php echo $dnn2['oglas_telefon']; ?><br />         <?php echo $dnn2['oglas_datum']; ?></td>        <td class="votes"><?php echo $dnn2['oglas_id']; ?></td>     </tr> <?php } //We display pages site (again) ?>     <tr>        <td colspan="3" class="pages"><?php echo $pages_site; ?></td>     </tr> </table>



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
Ko je trenutno na forumu
 

Ukupno su 1182 korisnika na forumu :: 43 registrovanih, 4 sakrivenih i 1135 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: A.R.Chafee.Jr., amaterSRB, Bobrock1, ccoogg123, Centauro, dankisha, Denaya, dika69, djboj, Djokislav, doktor1964, DPera, DragoslavS, Džordžino, Fog of War, HrcAk47, hyla, Ivica1102, Još malo pa deda, kobaja77, Kubovac, ladro, laki_bb, mercedesamg, milanovic, milutin134, mrav pesadinac, naki011, Nemanja.M, prashinar, proka89, saputnik plavetnila, Springfield, ss10, Stanlio, Sumadija34, Tvrtko I, Vlada78, vladaa012, vladulns, yagosh, zeo, 1107