This is my count query:
$query="SELECT count(rating) as number_of_reviews FROM product_reviews WHERE product_id='$pid' AND status='approved'";
list($number_of_reviews)=mysql_fetch_array(mysql_query($query));
I also check to see if the surfer already has a review for this item...
$query="SELECT id FROM product_reviews WHERE product_id='$pid' AND userid='$UID' LIMIT 1";
list($SurferReviewed)=mysql_fetch_array(mysql_query($query));
Based on these 2 results, I want to display something specific...
if ($SurferReviewed=='')
{
$WriteReview="Write a review";
}
elseif ($SurferReviewed=='' && $number_of_reviews=='0')
{
$Write_a_Review="Be the first to write a review";
}
else
{
$Write_a_Review="You've already reviewed the item";
}
So basically I want it to check if user has already reviewed, and if so, display "You've already reviewed".
If they have not reviewed and there are 0 reviews, write "Be the first...".
If user has not reviewed but he would not be the first, write "Write a review".
Questions is: "Be the first to write a review" never shows up. Even if the condition exists.