i’m just trying to get the SUM of votes of two unique id’s per query in one specific table. each contestant has three seperate posts that can be voted on and i figured this would do it, just wondering if it looks right. This is in my functions.php page
[code=php]
//team one
function totalVotesOne ($intTotalOneVotes) {
$query=”SELECT SUM(totalvotes) as total_one FROM “.DB_DATABASE.”.bonusvotes_2010 WHERE bonusvotes_2010.contestantID= IN (‘2093,538’) AND bonusvotes_2010.status=’Valid'”;
$result=mysql_query($query);
return mysql_num_rows($result);
}
//team two
function totalVotesTwo ($intTotalTwoVotes) {
$query=”SELECT SUM(totalvotes) as total_two FROM “.DB_DATABASE.”.bonusvotes_2010 WHERE bonusvotes_2010.contestantID= IN (‘5449,2888’) AND bonusvotes_2010.status=’Valid'”;
$result=mysql_query($query);
return mysql_num_rows($result);
}
//team three
function totalVotesThree ($intTotalThreeVotes) {
$query=”SELECT SUM(totalvotes) as total_three FROM “.DB_DATABASE.”.bonusvotes_2010 WHERE bonusvotes_2010.contestantID= IN (‘3460,242’) AND bonusvotes_2010.status=’Valid'”;
$result=mysql_query($query);
return mysql_num_rows($result);
}
and i’m calling from index.php with this:
Current Total Votes:<?=$totalVotesOne?>
Current Total Votes:<?=$totalVotesTwo?>
Current Total Votes:<?=$totalVotesThree?>
to no avail, i get no results???