table name--- voter
field name voter
type integer
I am selecting distinct values from this table, getting sum of voter field, and echoing this field in a loop.
I need to take the above summed value result in variable and display the maximum value from this sum field. How can I accomplish this?
Here's my code:
<?php
$party = $rowco['partyname'];
$district = $rowco['district'];
$constituency = $rowco['constituency'];
$sqlvotes = "SELECT SUM(votes) AS vote,constituency FROM voter_count where state = '$state' AND partyname = '$party' AND district = '$district' AND constituency = '$constituency'";
$resultvotes = mysql_query($sqlvotes);
while($rowvotes = mysql_fetch_array($resultvotes,MYSQL_ASSOC))
{
?>
<th><?php echo $rowvotes['vote']; ?></th>
<th><?php echo $rowvotes['constituency']; ?></th>
</tr>
<?php } ?>