if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$max_results = 12;
$te=explode("--",$_GET[pcat]);
/*if($te[1]=="")
{
echo "cat";
}
else
{
echo "Subcat";
}*/
$from = (($page * $max_results) - $max_results);
if($te[1]=="" and $_GET[pcat])
{
$rateqry="SELECT * FROM yellow_agents,yellow_posts where yellow_agents.regtype='1' and yellow_posts.logo!='' and yellow_posts.CategoryID='$_GET[pcat]' and yellow_posts.AgentID=yellow_agents.AgentID order by yellow_posts.PostDate desc LIMIT $from, $max_results";
$rateq=mysql_query($rateqry)or die($rateqry);
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM yellow_agents,yellow_posts where yellow_agents.regtype='1' and yellow_posts.logo!='' and yellow_posts.CategoryID='$_GET[pcat]' and yellow_posts.AgentID=yellow_agents.AgentID"),0);
$total_pages = ceil($total_results / $max_results);
$counted=1;
}
else if($te[1]!="" and $_GET[pcat])
{
$rateqry="SELECT * FROM yellow_agents,yellow_posts where yellow_agents.regtype='1' and yellow_posts.logo!='' and yellow_posts.SubCategoryID ='$te[1]' and yellow_posts.AgentID=yellow_agents.AgentID order by yellow_posts.PostDate desc LIMIT $from, $max_results";
$rateq=mysql_query($rateqry)or die($rateqry);
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM yellow_agents,yellow_posts where yellow_agents.regtype='1' and yellow_posts.logo!='' and yellow_posts.SubCategoryID ='$te[1]' and yellow_posts.AgentID=yellow_agents.AgentID"),0);
$total_pages = ceil($total_results / $max_results);
$counted=1;
}
else
{
$rateqry="SELECT * FROM yellow_agents,yellow_posts where yellow_agents.regtype='1' and yellow_posts.logo!='' and yellow_posts.AgentID=yellow_agents.AgentID order by yellow_posts.PostDate desc LIMIT $from, $max_results";
$rateq=mysql_query($rateqry)or die($rateqry);
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM yellow_agents,yellow_posts where yellow_agents.regtype='1' and yellow_posts.logo!='' and yellow_posts.AgentID=yellow_agents.AgentID"),0);
$total_pages = ceil($total_results / $max_results);
$counted=1;
}
?>