diff --git a/dao.php b/dao.php index 190ee3c..976bb55 100644 --- a/dao.php +++ b/dao.php @@ -12,13 +12,13 @@ class Dao { public function getConnection () { return - new PDO("mysql:host={$this->host};dbname={$this->db};port={$this->dbport}", $this->user, $this->pass); + new PDO("mysql:host={$this->host};dbname={$this->db};port={$this->dbport}", $this->user, $this->dbpassword); } public function saveComment ($comment) { $conn = $this->getConnection(); $saveQuery = - "INSERT INTO comment + "INSERT INTO comments (comment) VALUES (:comment)"; @@ -29,6 +29,19 @@ public function saveComment ($comment) { public function getComments () { $conn = $this->getConnection(); - return $conn->query("SELECT * FROM comment"); + return $conn->query("SELECT * FROM comments"); } + + public function saveJson ($data) { + $conn = $this->getConnection(); + foreach ($data as $item) { + $saveQuery = "INSERT INTO lawmakers + (first_name, last_name, middle_name, district, party, active, chamber, photo_url) + VALUES(:item['first_name']."', '".$item['last_name']."', '".$item['middle_name']."', '".$item['district']."', '".$item['party']."', '".$item['active']."', '".$item['chamber']."', '".$item['photo_url']."'); + $q = $conn->prepare($saveQuery); + $q->bindParam(":item", $item); + $q->execute(); + } + + } // end Dao \ No newline at end of file diff --git a/handler.php b/handler.php new file mode 100644 index 0000000..43195cc --- /dev/null +++ b/handler.php @@ -0,0 +1,18 @@ +saveComment($comment); + } catch (Exception $e) { + var_dump($e); + die; + } + } + header("Location:index.php"); \ No newline at end of file diff --git a/index.php b/index.php index ac8aaf0..37005e9 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,7 @@ @@ -9,17 +10,15 @@ -

Most Active

-
S 1081 -
+
S 1081
Passed Senate, 2/20/2015
Summary: HEALTH CARE - Amends existing law to provide reserves and surplus requirements of public postsecondary educational institutions with a public postsecondary educational institution plan for health care benefits.
-
+
-
- Conrad says: Best bill ever ... Lorem ipsum dolor sit amet, nobis suavitate iracundia ei his, ad nihil eirmod quo, viris temporibus qui eu. Et idque omnes instructior usu, qui ut posse everti lobortis, id his deserunt assentior. - Quo oratio senserit te, verterem constituto usu ut. Te pro aeque equidem maluisset, ponderum consetetur sea no. At volutpat torquatos adipiscing est, tempor temporibus in cum. -
-
- Sarah says: Could go either way... Lorem ipsum dolor sit amet, nobis suavitate iracundia ei his, ad nihil eirmod quo, viris temporibus qui eu. Et idque omnes instructior usu, qui ut posse everti lobortis, id his deserunt assentior. - Quo oratio senserit te, verterem constituto usu ut. Te pro aeque equidem maluisset, ponderum consetetur sea no. At volutpat torquatos adipiscing est, tempor temporibus in cum. -
-
- José says: Impeach! Impeach! Lorem ipsum dolor sit amet, nobis suavitate iracundia ei his, ad nihil eirmod quo, viris temporibus qui eu. Et idque omnes instructior usu, qui ut posse everti lobortis, id his deserunt assentior. - Quo oratio senserit te, verterem constituto usu ut. Te pro aeque equidem maluisset, ponderum consetetur sea no. At volutpat torquatos adipiscing est, tempor temporibus in cum. + getComments(); + echo ""; + foreach ($comments as $comment) { + echo ""; + echo ""; + # echo ""; + echo ""; + } + echo "
" . $comment["comment"] . "" . $comment["created"] . "
"; + ?>
-
-
+
diff --git a/lawmakers.php b/lawmakers.php index e52dfa0..c8a5acc 100644 --- a/lawmakers.php +++ b/lawmakers.php @@ -1,9 +1,56 @@ +include 'top.php'; +require_once "Dao.php"; ?>
- + \ No newline at end of file +/* get the legislator details +// FIXXXXXX extra fields + $suffix = $data['personal']['address']['streetaddress']; + $nickname = $data['personal']['address']['city']; + $website = $data['personal']['address']['postalcode']; + + $first_name = $data['first_name']; + $last_name = $data['last_name']; + $middle_name = $data['middle_name']; + $district = $data['district']; + $party = $data['party']; + $active = $data['active']; + $chamber = $data['chamber']; + $photo_url = $data['photo_url']; + + + $sql = "INSERT INTO lawmakers(first_name, last_name, middle_name, district, party, active, chamber, photo_url) + VALUES('$first_name', '$last_name', '$middle_name', '$district', '$party', '$active', '$chamber', '$photo_url')"; + if(!mysql_query($sql,$con)) + { + die('Error inserting data: ' . mysql_error()); + } + } + + VALUES('".$item['first_name']."', '".$item['last_name']."', '".$item['middle_name']."', '".$item['district']."', '".$item['party']."', '".$item['active']."', '".$item['chamber']."', '".$item['photo_url']."'); +*/ + + try { + $dao = new Dao(); + } catch (Exception $e) { + var_dump($e); + die; + } + +//insert into mysql table + saveJson($data); + + + + include 'footer.php'; ?> \ No newline at end of file diff --git a/login_test.php b/login_test.php deleted file mode 100644 index b518258..0000000 --- a/login_test.php +++ /dev/null @@ -1,22 +0,0 @@ - - -

Login successful! Welcome back, .

- -

Sorry, incorrect user name or password.

- diff --git a/newaccount.php b/newaccount.php index 9bd992a..4e3187f 100644 --- a/newaccount.php +++ b/newaccount.php @@ -1 +1,67 @@ -new user account \ No newline at end of file + + +
+ +
+
+ Legislative Dash +
+ +
Create new account
+
+
+
+ + + + + + +
+ +
+
+
+ +
+
+

Most Active

+
S 1081
+
Passed Senate, 2/20/2015
+
Summary: HEALTH CARE - Amends existing law to provide reserves and surplus requirements of public postsecondary educational institutions with a public postsecondary educational institution plan for health care benefits.
+
+
+
+ + + + + + +
+
+
+ Conrad says: Best bill ever ... Lorem ipsum dolor sit amet, nobis suavitate iracundia ei his, ad nihil eirmod quo, viris temporibus qui eu. Et idque omnes instructior usu, qui ut posse everti lobortis, id his deserunt assentior. + Quo oratio senserit te, verterem constituto usu ut. Te pro aeque equidem maluisset, ponderum consetetur sea no. At volutpat torquatos adipiscing est, tempor temporibus in cum. +
+
+ Sarah says: Could go either way... Lorem ipsum dolor sit amet, nobis suavitate iracundia ei his, ad nihil eirmod quo, viris temporibus qui eu. Et idque omnes instructior usu, qui ut posse everti lobortis, id his deserunt assentior. + Quo oratio senserit te, verterem constituto usu ut. Te pro aeque equidem maluisset, ponderum consetetur sea no. At volutpat torquatos adipiscing est, tempor temporibus in cum. +
+
+ José says: Impeach! Impeach! Lorem ipsum dolor sit amet, nobis suavitate iracundia ei his, ad nihil eirmod quo, viris temporibus qui eu. Et idque omnes instructior usu, qui ut posse everti lobortis, id his deserunt assentior. + Quo oratio senserit te, verterem constituto usu ut. Te pro aeque equidem maluisset, ponderum consetetur sea no. At volutpat torquatos adipiscing est, tempor temporibus in cum. +
+
+
+
+
+ + \ No newline at end of file diff --git a/users.php b/users.php index 1abedd2..48a634b 100644 --- a/users.php +++ b/users.php @@ -38,5 +38,5 @@ function redirect($url, $flash_message = NULL) { function new_user($name, $password, $user_info) { $db = new PDO("mysql:host=127.0.0.1;port=8889;dbname=idleg_test", "root", "root"); - + } ?> \ No newline at end of file