Index: trunk/extensions/CongressLookup/CongressLookup.db.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | * @return array |
12 | 12 | */ |
13 | 13 | public static function getRepresentative( $zip ) { |
| 14 | + $repData = array(); |
14 | 15 | $dbr = wfGetDB( DB_SLAVE ); |
15 | 16 | |
16 | 17 | $zip = self::trimZip( $zip, 5 ); // Trim it to 5 digit |
— | — | @@ -19,6 +20,7 @@ |
20 | 21 | if ( $row ) { |
21 | 22 | // TODO: stuffz. |
22 | 23 | } |
| 24 | + return $repData; |
23 | 25 | } |
24 | 26 | |
25 | 27 | /** |
— | — | @@ -27,6 +29,7 @@ |
28 | 30 | * @return array |
29 | 31 | */ |
30 | 32 | public static function getSenators( $zip ) { |
| 33 | + $senatorData = array(); |
31 | 34 | $dbr = wfGetDB( DB_SLAVE ); |
32 | 35 | |
33 | 36 | $zip = self::trimZip( $zip, 3 ); // Trim it to 3 digit |
— | — | @@ -34,8 +37,29 @@ |
35 | 38 | |
36 | 39 | $row = $dbr->selectRow( 'cl_zip3', 'sz3_state', array( 'sz3_zip' => $zip ) ); |
37 | 40 | if ( $row ) { |
38 | | - // TODO: stuffz. |
| 41 | + $state = $row->state; |
| 42 | + $res = $dbr->select( |
| 43 | + 'cl_senate', |
| 44 | + array( |
| 45 | + 'ss_bioguideid', |
| 46 | + 'ss_gender', |
| 47 | + 'ss_name', |
| 48 | + 'ss_title', |
| 49 | + 'ss_state', |
| 50 | + 'ss_phone', |
| 51 | + 'ss_fax', |
| 52 | + 'ss_contactform' |
| 53 | + ), |
| 54 | + array( |
| 55 | + 'ss_state' => $state, |
| 56 | + ), |
| 57 | + __METHOD__ |
| 58 | + ); |
| 59 | + foreach ( $res as $row ) { |
| 60 | + // TODO: stuffz. |
| 61 | + } |
39 | 62 | } |
| 63 | + return $senatorData; |
40 | 64 | } |
41 | 65 | |
42 | 66 | /** |