Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. $host = "(My real info here)";
  4. $user = "(My real info here)";
  5. $password = "(My real info here)";
  6. $db = "(My real info here)";
  7.  
  8. $sql = "select * from user;";
  9.  
  10. $con = mysqli_connect($host, $user, $password, $db);
  11.  
  12. $result = mysqli_query($con,&sql);
  13.  
  14. $response = array();
  15.  
  16. while(&row = mysqli_fetch_array($result))
  17. {
  18.  
  19. array_push($response,array("name"=>$row[1]),"class">$row[3]));
  20. }
  21.  
  22. echo json_encode(array("server_response"=>$response));
  23.  
  24. mysqli_close($con);
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement