Show total results from rating in mysql
Posted: 22 Feb 2017, 18:34
I have a rating script where new people able to rate from 1 till 5.
Now i have this simple code what shows the total number of rates:
I wanna have the total score which the people rated on the article_id.
this is my data-base
I hope you can help me out
Now i have this simple code what shows the total number of rates:
Code: Select all
<?php
include('../connection.php');
$article_id = (int) $_GET['article_id'];
$result = $conn->query("SELECT COUNT(*) FROM `article_rating` WHERE article_id='" . $article_id . "'");
$row = $result->fetch_row();
echo 'My Score ', $row[0];
?>
this is my data-base
Code: Select all
article_id rating