Skip to content

Commit

Permalink
Continue menu generation work
Browse files Browse the repository at this point in the history
Toward #296.
  • Loading branch information
waldoj committed Jan 10, 2020
1 parent e06d810 commit a93df44
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions deploy/generate-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@
/*
* Get a list of all legislators.
*/
$sql = 'SELECT name, name_formatted, shortname, chamber
FROM representatives
WHERE date_ended IS NOT NULL OR date_ended >= now()
ORDER BY chamber ASC, name ASC';
$result = mysqli_query($db, $sql);
$legislator = new Legislator;
$legislator_list = $legislator->list('current');

$legislators = array('house' => array(), 'senate' => array());

/*
* Build up an HTML-formatted array of legislators by chamber.
*/
while ($legislator = mysqli_fetch_assoc($result))
foreach ($legislator_list as $legislator)
{

$legislator = array_map('stripslashes', $legislator);
$legislators[$legislator{'chamber'}][substr($legislator{'name'}, 0, 1)][] = '<li><a href="/legislator/' . $legislator['shortname']
. '/">' . $legislator['name_formatted'] . '</a></li>';

Expand Down

0 comments on commit a93df44

Please sign in to comment.