Jump to content

MYSQL query problem


marklarah

Recommended Posts

So I'm building a thumbs up/thumbs down rating system, and for the most part it's working. The fields in the table is either -1 or 1 for an up or down, and it counts it all to get the final rating, using this:

$query="SELECT SUM(rating) AS `total` from votes WHERE sid='$num'";
$result=mysql_query($query);
$total=mysql_result($result,0,"total");

 

where $total will obviously be the final rating. How would I get the number of rows that it counted, so it could say something like Rating: 23, with 48 votes or something?

 

thanks

mark

Link to comment
https://forums.phpfreaks.com/topic/195201-mysql-query-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.