Advertisement
Guest User

Untitled

a guest
May 13th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. $db_connection = pg_connect("host=localhost dbname=xxx user=xxx password=xxx");
  2. $result = pg_query($db_connection, "SELECT * FROM taxi_stats.satisfy");
  3. $data = array();
  4. while ($row = pg_fetch_array($result))
  5. {
  6. $data[] = $row;
  7. }
  8. echo json_encode($data);
  9. pg_close($db_connection);
  10.  
  11. <script>
  12. d3.json("data.php", function(error, data) {
  13. if(error){
  14. console.log(error);
  15. }
  16. console.log(data);
  17. });
  18. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement