require_once("conn.php");
require_once("includes.php");
require_once("templates/HeaderTemplate.php");
require_once("advanced.php");
require_once("templates/AdvancedSearchTemplate.php");
//Check for subcategories
$c = isset($c) ? $c: '';
$c = isset($_GET['c']) ? $_GET['c'] : '';
if($c)
{
$catq="select * from yellow_subcat where rootcatid='$_GET[c]' order by subcatname asc";
$cats=mysql_query($catq);
if(mysql_num_rows($cats)!=0)
{ ?>
Select
a Subcategory |
//Check for rows and columns
$counted=1;
while($catsl = mysql_fetch_array($cats))
{
?>
|
}?>
$counted=$counted+1;
}
?>
}
else
{
echo "No Subcategories were found!";
}
}
else
{
$query = array();
if(!empty($_GET['c']))
{
$query[] = "yellow_posts.CategoryID = '$_GET[c]' ";
}
if(!empty($_GET['CategoryID']))
{
$query[] = "yellow_posts.CategoryID = '$_GET[CategoryID]' ";
}
if(!empty($_GET['s']))
{
$query[] = "yellow_posts.SubCategoryID = '$_GET[s]' ";
}
if(!empty($_GET['old']))
{
$MyExp2 = time()-(24*60*60*$_GET['old']);
$query[] = "yellow_posts.PostDate > '$MyExp2' ";
}
if(!empty($_GET['search_country']))
{
$query[] = "yellow_agents.country = '$_GET[search_country]' ";
}
if(!empty($_GET['search_state']))
{
$query[] = "yellow_agents.state = '$_GET[search_state]' ";
}
if(!empty($_GET['search_city']))
{
$query[] = "yellow_agents.city = '$_GET[search_city]' ";
}
if(!empty($_GET['search_kw']))
{
$query[] = " (yellow_posts.resume like '%$_GET[search_kw]%' or yellow_posts.CompanyName like '%$_GET[search_kw]%') ";
}
if(!empty($_GET['zip']))
{
$query[] = " (yellow_agents.zipcode like '%$_GET[zip]%') ";
}
if(!empty($query))
{
$MyQuery = implode(" and ", $query);
$MyQuery = " and ".$MyQuery;
}
////////////////////////////////////////////////////////////
////////// order by
////////////////////////////////////////////////////////////
$order = array();
if(!empty($_GET['orderby']))
{
$MyOrder = explode("|", $_GET[orderby]);
while(list(,$ov) = each($MyOrder))
{
if($ov == "DateAdded")
{
$order[] = " yellow_agents.RegDate desc ";
}
if($ov == "address")
{
$order[] = " yellow_agents.address asc ";
}
}
}
else
{
if(!empty($_GET['p']))
{
$order[] = " yellow_agents.RegDate desc ";
}
}
if(count($order) > '0')
{
$MyOrder = implode(", ", $order);
}
if($aset['Sitefee']=="0")
{
if(empty($MyOrder))
{
$MyOrder = " order by yellow_agents.AgentID desc, yellow_agents.RegDate desc";
}
else
{
$MyOrder = " order by yellow_agents.AgentID desc, $MyOrder, yellow_agents.RegDate desc";
}
}
if(!empty($_GET['Start']))
{
$Start = $_GET['Start'];
}
else
{
$Start = '0';
}
$ByPage = '20';
if($aset['Sitefee']=="1")
{
$q1 = "select * from yellow_agents, yellow_categories,yellow_subcat,yellow_posts where yellow_posts.CategoryID = yellow_categories.CategoryID and yellow_agents.AccountStatus = 'active' and yellow_posts.AgentID=yellow_agents.AgentID and yellow_posts.SubCategoryID = yellow_subcat.subcatid $MyQuery $MyOrder limit $Start, $ByPage ";
$qnav = "select * from yellow_agents, yellow_posts, yellow_categories where yellow_posts.CategoryID = yellow_categories.CategoryID and yellow_agents.AccountStatus = 'active' and yellow_posts.AgentID=yellow_agents.AgentID $MyQuery";
}
else
{
/*$q1 = "select * from yellow_agents, yellow_priority, yellow_categories,yellow_subcat where yellow_agents.CategoryID = yellow_categories.CategoryID and yellow_agents.PriorityLevel = yellow_priority.PriorityLevel and yellow_agents.AccountStatus = 'active' and yellow_agents.SubCategoryID = yellow_subcat.subcatid $MyQuery $MyOrder limit $Start, $ByPage ";
$qnav = "select * from yellow_agents, yellow_priority, yellow_categories where yellow_agents.CategoryID = yellow_categories.CategoryID and yellow_agents.PriorityLevel = yellow_priority.PriorityLevel and yellow_agents.AccountStatus = 'active' $MyQuery";*/
$MyQuery = isset($MyQuery) ? $MyQuery: '';
$q1 = "select * from yellow_agents, yellow_categories,yellow_subcat,yellow_posts where yellow_posts.CategoryID = yellow_categories.CategoryID and yellow_agents.AccountStatus = 'active' and yellow_posts.SubCategoryID = yellow_subcat.subcatid and yellow_posts.AgentID=yellow_agents.AgentID $MyQuery $MyOrder limit $Start, $ByPage ";
$MyQuery = isset($MyQuery) ? $MyQuery: '';
$qnav = "select * from yellow_agents, yellow_categories,yellow_posts where yellow_posts.CategoryID = yellow_categories.CategoryID and yellow_agents.AccountStatus = 'active' and yellow_posts.AgentID=yellow_agents.AgentID $MyQuery";
}
$r1 = mysql_query($q1) or die(mysql_error());
$lrows = mysql_num_rows($r1);
if($lrows > '0')
{
$ListingTable .= "\n";
$ListingTable .= "Category | Title | Added | Ad Expires | Rating |
";
while($a1 = mysql_fetch_array($r1))
{
$rate="SELECT avg(rated) as abcde FROM yellow_rating WHERE mediaid ='".$a1[PostID]."' GROUP BY mediaid";
$rank="";
$rateq=mysql_query($rate)or die($rate);
$rateline=mysql_fetch_array($rateq);
$count=1;
while($count<=round($rateline[abcde]))
{
// echo 1;
$rank.= "";
$count=$count+1;
}
$ListingTable .= "\n\t";
/* $ListingTable .= "";
$ListingTable .= "\n";
$ListingTable .= "";
/* if(!empty($a1[logo]))
{
$MyImage = $a1[logo];
$ListingTable .= "";
}
else
{
$ListingTable .= "";
}
*/
//$ListingTable .= "\n\t";
$ListingTable .= "".$a1[CategoryName]." | ".$a1[CompanyName]." | \n".date('m-d-y',$a1[PostDate])." | ".date('m-d-y',$a1[ExpDate])." | ".$rank." | \n";
$ShortDesc = substr($a1[DetailedDesc], 0, 200);
$ListingTable .= "\n\n";
}
$rnav = mysql_query($qnav) or die(mysql_error());
$rows = mysql_num_rows($rnav);
if($rows > $ByPage)
{
$ListingTable .= "
";
$ListingTable .= " | ";
$pages = ceil($rows/$ByPage);
for($i = 0; $i <= ($pages); $i++)
{
$PageStart = $ByPage*$i;
$i2 = $i + 1;
if($PageStart == $Start)
{
$links[] = " $i2\n\t ";
}
elseif($PageStart < $rows)
{
$links[] = " $i2\n\t ";
}
}
$links2 = implode(" | ", $links);
$ListingTable .= $links2;
$ListingTable .= "| | ";
$ListingTable .= " \n";
}
}
else
{
$ListingTable = "
No results were found!";
}
}
include("templates/SearchTemplate.php");
include("templates/FooterTemplate.php");
?> |