cyberfly 1 Report post Posted April 19, 2008 Seperti gmbar di atas, column tempat tu merupakan kedudukan peserta yg disort berdasarkan jumlah markah tertinggi.Masalah ialah,bila aku klik link ke page 2,tempat tu akan papar no 1 balik.bukan no 17.data yg lain semua dah betul.cuma no tu je.no coding aku untuk no tu : <?php $single="SELECT * FROM (SELECT *,game1+game2+game3+game4+game5+game6 AS 'JumlahMarkah' FROM markah WHERE idFormat='4' AND idPertandingan='$idpertandingan') temp ORDER BY JumlahMarkah DESC"; $pager = new pager($single,'page',25); $kedudukan = 0; while($array = mysql_fetch_array($pager->result)){ ?> <?php $kedudukan = $kedudukan + 1; ?> Quote Share this post Link to post Share on other sites
ejoe 0 Report post Posted April 19, 2008 (edited) var $kedudukan tu ko kena ubah skitcth aku buat<?phpmysql_connect('localhost','root','');mysql_select_db('try');//limit view data per page$limit = 2;// jika nilai di atas kosong, maka tetapkan nilai default untuk $offsetif(empty($_GET['page'])){$offset = 0;$page=1;}else{$offset = ($_GET['page']-1) * $limit;}?><table border=1"><tr><td>No</td><td>ID</td><td>Data</td></tr><?php$kaunter=0;$qid = mysql_query("select * from next_previous limit $offset,$limit");while($data = mysql_fetch_array($qid)){$kaunter++;$no = $offset + $kaunter;echo "<tr>";echo "<td>$no</td>";echo "<td>$data['id]</td>";echo "<td>$data['data']</td>";echo "</td></tr>";}?></table><?php// untuk menghasilkan << 1 2 3 >>$qid = mysql_query('select id from next_previous');$total = mysql_num_rows($qid);//untuk mengetahui jumlah halaman$total_page = ceil($total/$limit);// echo link ke halaman sebelumif(!empty($_GET['page']) && $_GET['page'] != 1){$previous_page = $page-1;echo '<a href=test.php?page=' . $previous_page . '"><<</a>';}else{ echo "<<"; }// untuk 1 2 3 4 5for($i=1;$i<=$total_page;$i++){echo ' <a href="test.php?page=' . $i . '">' . $i . '</a> ';}// untuk link kehalaman berikutif($_GET['page] < $total_page){$next_page = $page+1;echo '<a href="test.php?page=' . $next_page . '">>></a>';}else{ echo ">>"; }?>http://www.ejoe.net/forum/tutorial_view.ph...e=php&id=86 Edited April 20, 2008 by ejoe Quote Share this post Link to post Share on other sites
cyberfly 1 Report post Posted April 19, 2008 var $kedudan tu ko kena ubah skitcth aku buathttp://www.ejoe.net/forum/tutorial_view.ph...e=php&id=86ejoe,bleh terangkan tak camne nak ubah?aku tak tngkap maksud ko paging tu memang dah menjadi,data akn berubah bila klik page lain,cuma kedudkan tu je Quote Share this post Link to post Share on other sites
ejoe 0 Report post Posted April 20, 2008 $qid = mysql_query("select * from next_previous limit $offset,$limit");while($data = mysql_fetch_array($qid)){$kaunter++;$no = $offset + $kaunter;sql aku tu ader guna var $offset, then masa nak kira bil tu aku akan guna $offset tu nak kirabetter ko amik cth aku bg n masukkan sql ko Quote Share this post Link to post Share on other sites