Hi
I want to select the highest star rating from my database for a group of records of specific page egcafe_1) so somthing like this happens:
mysql_query("SELECT Rating WHERE id =("cafe_1") COUNT(page_id) AS total FROM =("cafe_1") ORDER BY 'total' DESC LIMIT 1"");
I hope you understand what I mean.....
Any help appreciated.
thanks
Peter
Hi Steven,
yes I guess but I want it to display the best rating on a page that has
a list of the pages with the comments on.So the page is like this but the comments themselves are on the cafe1.php cafe1.php cafe1.php pages
Does this seem right?
<body>
<div id="content">
<?php include("../content/cafe1.php"); ?>
$rating_cafe_1 =mysql_query("SELECT MAX(rating) FROM comments WHERE is_approved = '1' AND rating != '0' AND page_id = 'cafe_1');
echo $"[rating_cafe_1]"
</div>
<div id="content1">
<?php include("../content/cafe2.php"); ?>
$rating_cafe_2 =mysql_query("SELECT MAX(rating) FROM comments WHERE is_approved = '1' AND rating != '0' AND page_id = 'cafe_2');
echo $"[rating_cafe2]"
</div>
<div id="content2">
<?php include("../content/cafe3.php"); ?>
$rating_cafe_3' =mysql_query("SELECT MAX(rating) FROM comments WHERE is_approved = '1' AND rating != '0' AND page_id = 'cafe_3');
echo $"[rating_cafe_3]"
</div>
</body>
Thanks for your help
Peter
Hello Steven,
I am working on restaurants, as some towns have more than 1 restaurant
I have individual restaurant pages with a comments form on.
I have a town page with a description, an include from the all restaurant pages in that town. I want to add the rating of each restaurant to this Town page and if the restaurant is not yet rated display "waiting for a rating".
hope this is clear.
restos.jpg attatched
thanks for your help
Peter
Hi Steven.
here is updated jpg of what i want my page to look like. But I cant get code right.
This is code I am using:
<?php
define ('IN_COMMENTICS', '1');
require "../comments/includes/db/connect.php";
$rating_cagarol = mysql_query("SELECT MAX(rating) FROM comments WHERE is_approved = '1' AND rating != '0' AND page_id = 'cagarol.php'");
Hi Steven,
will this take care of the display of the stars. How do I tie this in with the sql query
case "1":
echo"Highest rating";
echo "<img src=\"../images/star1.png\"/>";
break;
case"2":
echo"Highest rating";
echo "<img src=\"../images/star2.png\"/>";
break;
case"3":
echo"Highest rating";
echo "<img src=\"../images/star3.png\"/>";
break;
case"4":
echo"Highest rating";
echo "<img src=\"../images/star4.png\"/>";
break;
case"5":
echo"Highest rating";
echo "<img src=\"../images/star5.png\"/>";
break;
default:
echo "Waiting for a star rating";
break;
Hi Steven
I Inserted code on my php page.
and I am getting errors on my page.
Warning: mysql_query() [function.mysql-query]: Access denied for user 'a7DELETED/'@'localhost' (using password: NO) in /home/a7DELETED/public_html/villages/aigne.php on line 93
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a7DELETED/public_html/villages/aigne.php on line 94
Thanks for your help
Peter