Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // database settings
- $db_username = "****";
- $db_password = "****";
- $db_name = "****";
- $db_host = "****";
- //open connection to mysql db
- $connection = mysqli_connect("$db_host","$db_username","$db_password","$db_name") or die("Error " . mysqli_error($connection));
- //fetch table rows from mysql db
- $sql = "select * from markers";
- $result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
- //create an array
- $emparray = array();
- while($row =mysqli_fetch_assoc($result))
- {
- $emparray[] = $row;
- }
- $data = array($emparray);
- echo json_encode($data);
- [enter image description here][1]
- //close the db connection
- mysqli_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement