Trying to get SUM to work???

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.

[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);
}
[/php]

and i’m calling the results from my index.php with:

[php]
Current Total Votes:<?=$totalVotesOne?>
Current Total Votes:<?=$totalVotesTwo?>
Current Total Votes:<?=$totalVotesThree?>
[/php]

but it won’t return any results???

sorry I’m having trouble reading that can you clean it up at all?

Sponsor our Newsletter | Privacy Policy | Terms of Service