14-May-2020, 03:39 PM
Hi
I used to use this script to display stars but it no longer works.(this is from commentics1.7)
I uploaded: upload/comments/includes/db/connect.php
<?php
define ('IN_COMMENTICS', '1');
require "upload/comments/includes/db/connect.php";
/*custom_id = page name */
$query = mysql_query("SELECT id FROM `".$mysql_table_prefix."pages` WHERE custom_id = 'Page Four'");
$result = mysql_fetch_assoc($query);
$id = $result["id"];
$query = mysql_query("SELECT MAX(rating) AS highest_rating FROM `".$mysql_table_prefix."comments` WHERE is_approved = '1' AND page_id = '$id'");
$result = mysql_fetch_assoc($query);
$highest_rating = $result["highest_rating"];
switch ($highest_rating) {
case 0:
echo "It's waiting for a star rating";
break;
case 1:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 2:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 2.5:
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 3:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 3.5:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 4:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 4.5:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
break;
case 5:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
break;
}
?>
Any help welcome
Thanks
I used to use this script to display stars but it no longer works.(this is from commentics1.7)
I uploaded: upload/comments/includes/db/connect.php
<?php
define ('IN_COMMENTICS', '1');
require "upload/comments/includes/db/connect.php";
/*custom_id = page name */
$query = mysql_query("SELECT id FROM `".$mysql_table_prefix."pages` WHERE custom_id = 'Page Four'");
$result = mysql_fetch_assoc($query);
$id = $result["id"];
$query = mysql_query("SELECT MAX(rating) AS highest_rating FROM `".$mysql_table_prefix."comments` WHERE is_approved = '1' AND page_id = '$id'");
$result = mysql_fetch_assoc($query);
$highest_rating = $result["highest_rating"];
switch ($highest_rating) {
case 0:
echo "It's waiting for a star rating";
break;
case 1:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 2:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 2.5:
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 3:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 3.5:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 4:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_empty.png'/>";
break;
case 4.5:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_half.png'/>";
break;
case 5:
echo "Best score so far";
echo " ";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
echo "<img src='//comments/images/stars/star_full.png'/>";
break;
}
?>
Any help welcome
Thanks