Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = "*****";
- $password = "******";
- $host = "localhost";
- $database="db";
- $server = mysql_connect($host, $username, $password);
- $connection = mysql_select_db($database, $server);
- $myquery = "
- SELECT `this`, `that` FROM `table`
- ";
- $query = mysql_query($myquery);
- if ( ! $query ) {
- echo mysql_error();
- die;
- }
- $data = array();
- for ($x = 0; $x < mysql_num_rows($query); $x++) {
- $data[] = mysql_fetch_assoc($query);
- }
- $fp = fopen('empdata.json', 'w');
- fwrite($fp, json_encode($data));
- fclose($fp);
- mysql_close($server);
- ?>
- d3.json("mypreviouslygeneratedjson.json", function (error, data) {
- data.forEach(function (d)
- {
- ...
- }
- echo json_encode($data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement