Hello to all. I have this function:
$p=intval($_GET['p']); if (empty($p)){ $p=1;//страница } // навигатор по страницам function pages ($p){ global $id; $res = mysql_query("select count(*) from news WHERE category=".$id."");// ищем все новости в категории $row = mysql_result($res,0); $news_num = "10"; $b = ceil(($row/$news_num)); // выводим по столько записей на страницу $x=1; while ($b>=$x){ if ($x==$p){ $news = mysql_query("select count(*) from news"); $pages_cat .= '<b>'.$x.'</b>'; } else { $pages_cat .= ' <a href="/category/'.$id.'/'.$x.'/"><b>'.$x.'</b></a> '; } $x++; } return $pages_cat; }
Tell me how to finish it, for example, let's say $ pages_cat output 20 pages each, then a line feed, again 20 pages and so on until all the records in the database are finished?