Advertisement
Guest User

Untitled

a guest
May 27th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?PHP
  2. $servername = "156.17.130.204"; //replace it with your database server name
  3. $username = "root"; //replace it with your database username
  4. $password = "lato-2016!212"; //replace it with your database password
  5. $dbname = "zpi";
  6. // Create connection
  7. $conn = mysqli_connect($servername, $username, $password, $dbname);
  8. $conn->set_charset('utf8');
  9. // Check connection
  10. if (!$conn) {
  11. die("Connection failed: " . mysqli_connect_error());
  12. }
  13. $query = "SELECT * FROM gallery";
  14.  
  15. $result = mysqli_query($conn, $query);
  16.  
  17.  
  18. while($row = mysqli_fetch_assoc($result))
  19. {
  20.  
  21. $data[] = $row;
  22.  
  23.  
  24. }
  25.  
  26. header('Content-Type: application/json; Charset=UTF-8');
  27. echo (json_encode($data,JSON_UNESCAPED_UNICODE));
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement