View file wapcat/functions.php

File size: 702B
<?
function print_data($where_data,$page)
{
if(empty($page)) $page=0;
$query=mysql_query("SELECT id FROM $where_data;");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=20;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from $where_data where id>".$page." order by title limit 20;");
while($data=mysql_fetch_array($print))
{
print "<a href=\"".$data['link']."\">".$data['title']."</a><br/>";
}
for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if ($page_number!=$page) {
print "<a href=\"katalog.php?where=$where_data&amp;page=$page_number\">".($i+1)."</a>";
} else {
print ($i+1);
}
}
}
?>