<?php
include("../session.php");
include("../connect.php");

$id=$_GET['id'];
$user=$_GET['user'];
$a=0;
echo "<table style='width:410' border=0 cellpadding=5 cellspacing=5>";
$query=mysql_query("select * from company_review where companyID='$id' ORDER BY reviewID DESC");
	if(mysql_num_rows($query)==0){
		echo "<tr><td align=center>No Review</td></tr>";
	}
while($display=mysql_fetch_array($query)){
	$userID=$display['userID'];
	$rating=$display['rating'];
	$comment=$display['comment'];
	$date=$display['date'];
	$time=$display['time'];
	
	$query2=mysql_query("select * from phone_user where userID='$userID'");
	$display2 = mysql_fetch_array($query2);
	if ($display2['nickName'] == ""){
		$nickName= "UNKNOW USER";
	}else{
		$nickName= $display2['nickName'];
	}
	
	if($a%2==0){
		echo "<tr class='plus'><td>";
		echo "<table style='width:400' border=0>";
		echo "<tr>";
		echo "<td style='width:280'><b>$nickName</b></td>";
		echo "<td align=right style='width:120'><address class=review>$date&nbsp;&nbsp;&nbsp;$time</address></td></tr>";
		echo "<tr>";
		echo "<td style='width:280'>$comment</td>";
		echo "<td align=right style='width:120' valign='bottom'><b>Rate : </b>$rating</td></tr>
				</table></td></tr>";
	}else if($a%2==1){
		echo "<tr class='minus'><td>";
		echo "<table style='width:400' border=0>";
		echo "<tr>";
		echo "<td style='width:280'><b>$nickName</b></td>";
		echo "<td align=right style='width:120'><address class=review>$date&nbsp;&nbsp;&nbsp;$time</address></td></tr>";
		echo "<tr>";
		echo "<td style='width:280'>$comment</td>";
		echo "<td align=right style='width:120' valign='bottom'><b>Rate : </b>$rating</td></tr>
				</table></td></tr>";
	}
	$a++;
}
echo "</table>";
?>
<link href="header.css" rel="stylesheet" type="text/css"/>