The result is always 1:
$sql = 'SELECT COUNT(Vote) FROM ' . $table;
$res = mysql_query($sql, $conn);
$vote_total = mysql_num_rows($res);
I ran the $sql query in phpMyAdmin and it returns 3, so the query is not the problem. $vote_total is initialized globally to 0, so that 1 is coming from somewhere. What other information do I need to provide to make helping me easier?
Thanks,
Ryan
mysql_num_rowsreturns the number of selected rows and not the fields of a certain row. Usemysql_fetch_rowto fetch the row you have selected with your query:You could also use
mysql_resultto fetch a row and get a certain field:This fetches the first row (zero based) and returns the first field (zero based).