i have counted the number of voters that voted for certain candidate i want to display which one got the highest voting number. i tried to store them in variables so i can use max() method but i got the error "undefined ".any help please
<?php
$query="select count(*) as total from voting Where ca_id=1";
//ca_id is the candidate id that voter choose
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
echo"$row[total]<br>";
$query="select count(*) as total2 from voting Where ca_id=2";
$result = mysql_query($query);
$row2 = mysql_fetch_assoc($result);
echo"$row2[total2]<br>";
$query="select count(*) as total3 from voting Where ca_id=3";
$result = mysql_query($query);
$row3 = mysql_fetch_assoc($result);
echo"$row3[total3]<br>";
$query="select count(*) as total4 from voting Where ca_id=5";
$result = mysql_query($query);
$row4 = mysql_fetch_assoc($result);
echo"$row4[total4]<br>";
?>