Location: PHPKode > scripts > PHP Hosting Directory > phphost_directoryv2/include/reviews.php
<?

if ($request[1] != '')
{
	$sql_h = "SELECT h.*, SUM((r.speed+r.reliability+r.support+r.price)/40)/COUNT(*) AS rating, DATE_FORMAT(established, '%M %Y') as established FROM `hsl_host` h LEFT JOIN `hsl_review` r ON h.`name`=r.`company` WHERE h.`name`='".$request[1]."' GROUP BY h.`name`";
	
	$res_h = mysql_query($sql_h);
	$tmp = mysql_fetch_array($res_h);
	$tmp['rating'] = round($tmp['rating']*10);
	$host = $tmp;

	$t->assign('host', $host);

	$sql = "SELECT *, DATE_FORMAT(postdate, '%M. %d, %Y') as postdate FROM `hsl_review` WHERE `status`=1 AND `company`='".$request[1]."'";
	$res = mysql_query($sql);
	$reviews = array();
	$count = 1;
	while ( $review = mysql_fetch_array($res) )
	{
		$review['num'] = $count;
		array_push($reviews, $review);
		$count++;
	}
	
	$t->assign('reviews', $reviews);
	$t->assign('main_html', $request[0].'.html');
}
else
{
	java_redirect('/');
	$t->assign('main_html', $request[0].'.html');
}

?>
Return current item: PHP Hosting Directory