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 1164 korisnika na forumu :: 37 registrovanih, 5 sakrivenih i 1122 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 20624 - dana 04 Apr 2026 04:18

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: 357magnum, A.R.Chafee.Jr., abramac, Bbbggg1979, boromir, bpvl, BUDDAR70, Car89, Carbon, celik, crnogorac, Dusko_Dugousko, dzada, esx66, france93, Fructo, Ir, ivan1973, ladro, ljuba.b, Magarac, Marko Marković, mica6335, Natuzzi, Njemac, pein, Pilipenda, procesor, Radio operater, Sky diver 29, Szigetwar, umpah-pah, Vanderx, Veless, vlado_pg, zlaya011, Zorge