Petition Signatures Broken Down by LA Legislative District

Read the petition here.

<?php
$query=<< SELECT COUNT(`sid`) as `count`,`w1`.`data` as `sort`, `w2`.`name` as `name`
FROM `webform_submitted_data` as `w1`
LEFT JOIN `webform_email_names` as `w2` ON `w2`.`email` = `w1`.`data` AND `w2`.`type` = 16
WHERE `w1`.`nid` = 520 and `w1`.`cid` = 16
GROUP BY `sort`
order by `count` DESC
EOS;
$results=db_query_range($query,$uid,0,1000);
?>

<?php
while ($row = db_fetch_object($results)){
if (strlen($row->sort) >0){
?>

<?php
}
}
?>

Legislator's Name Number of Submissions
<?php
echo $row->name;
?>
<?php echo $row->count;
?>