Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php
  2. // Database credentials may differ on your machine
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $dbname = "appdev";
  7.  
  8. // Create connection
  9. $conn = mysqli_connect($servername, $username, $password, $dbname);
  10.  
  11. // Check connection
  12. if (!$conn) {
  13. die("Connection failed: " . mysqli_connect_error());
  14. }
  15.  
  16. // Use a mysql query to select data from the database
  17. $result = mysqli_query($conn, "SELECT * FROM locations");
  18.  
  19. if (mysqli_num_rows($result) > 0){
  20. while($row = mysqli_fetch_array($result)){
  21. echo "Lat: ". $row["lat"]. " Lon: " .$row["lon"];
  22. echo "<br/>";
  23. }
  24. }
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement