PHP / MySQL question

Techwhore

Golden Member
Aug 2, 2000
1,248
0
0
I'm scripting a poll and need to create an administrator page that'll display the results. What i'd like to do is have the percentages for each selection listed. I need to know how to script it so that i can run a select count(*) to get the total number of votes then divide that into the specific questions.

I can't seem to get it to display the oount, it comes up as resource id #2.

Here's the source I have now which produces the "resource id #2":

$count = "select count(*) from survey";
$count_result = mysql_db_query($dbname, $count, $id_link);
$count_this = mysql_result($count_result,0);

thanks in advance
 

RedRooster

Diamond Member
Sep 14, 2000
6,596
0
76
If you use the query you've already built(SELECT COUNT), do this instead:

$count_this=mysql_fetch_row($count_result);

then $count_this[0] will be an integer number.