sidrs Posted December 20, 2010 Report Share Posted December 20, 2010 Sadalu db ierakstus pa lapām, katrā lapā 4 ieraksti. Vaidzētu panakt, lai ieraksti numurējas pēc kārtas. pirma lapa 1, 2, 3 ,4 ieraksts. otra lapa 5, 6, 7, 8 ieraksts. Pagaidām rāda katrā lapā 1, 2, 3, 4 Varbūt kādam ir kāda ideja? kods $data = mysql_query("SELECT * FROM tabula") or die(mysql_error()); $rows = mysql_num_rows($data); $page_rows = 4; $last = ceil($rows/$page_rows); if($pagenum < 1) { $pagenum = 1; } elseif($pagenum > $last) { $pagenum = $last; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; $data_p = mysql_query("SELECT * FROM tabula order by skaits desc $max") or die(mysql_error()); while($info = mysql_fetch_array( $data_p )) { $n+=1; echo ' '.$n.' '.$info['name'].' <br /> '; } Quote Link to comment Share on other sites More sharing options...
Blitz Posted December 21, 2010 Report Share Posted December 21, 2010 (edited) $n=$pagenum*$page_$rows-$page_$rows; while($info = mysql_fetch_array( $data_p )) { $n+=1; echo ' '.$n.' '.$info['name'].' <br /> '; } un so: $data = mysql_query("SELECT * FROM tabula") or die(mysql_error()); $rows = mysql_num_rows($data); labak aizvietot ar: $data = mysql_query("SELECT count(*) FROM tabula") or die(mysql_error()); $row = mysql_fetch_row($data); $rows=$row[0]; kompitim daudz vieglak bus paveikt tadu pieprasijumu Edited December 21, 2010 by Blitz Quote Link to comment Share on other sites More sharing options...
sidrs Posted December 21, 2010 Author Report Share Posted December 21, 2010 Paldies par palīdzību tagad rāda tā kā vajag . :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.