Advertisement
Guest User

Untitled

a guest
Aug 8th, 2017
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. [{
  2. "0": "1",
  3. "id": "1",
  4. "1": "Hakob",
  5. "name": "Hakob",
  6. "2": "abc@email.com",
  7. "email": "abc@email.com"
  8. }, {
  9. "0": "2",
  10. "id": "2",
  11. "1": "Arsen",
  12. "name": "Arsen",
  13. "2": "zxc@email.com",
  14. "email": "zxc@email.com"
  15. }]
  16.  
  17. $sql = "SELECT * FROM contacts";
  18. $result = mysqli_query($connect, $sql);
  19. $response = array();
  20. while($row = mysqli_fetch_array($result)){
  21. $response[]=$row;
  22. }
  23.  
  24. print json_encode($response);
  25.  
  26. // Close connection
  27. mysqli_close($connect);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement