Codice PHP:
$category=$_GET["category"];
if($category){
$query=("and relations.relation_category=$category");
}
$query1=("select count(articles.article) from (articles join relations on relations.relation_article=articles.article) where articles.article_status=1 $query order by articles.article_time desc");
$count=mysql_query($query1,$mysql);
$res_count=mysql_fetch_row($count);
$tot_records=$res_count[0];
$per_page=5;
$tot_pages=ceil($tot_records/$per_page);
$current_page=(!$_GET["page"])?1:(int)$_GET["page"];
$primo=($current_page-1)*$per_page;
$query1=("select article, article_title, article_text, user_denomination from ((articles join users on users.user=articles.article_user) join relations on relations.relation_article=articles.article) where articles.article_status=1 $query order by articles.article_time desc limit $primo, $per_page");
$result1=mysql_query($query1,$mysql);
ecco, consigli? grazie