Advertisement
Guest User

Untitled

a guest
May 14th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "id1628750_camilo";
  5. $password = "1234qwer";
  6. $dbname = "id1628750_cappital";
  7.  
  8.  
  9. $con = mysqli_connect($servername, $username, $password, $dbname);
  10.  
  11. // query the application data
  12. $sql = "SELECT Nombre, Cantidad, Fecha FROM EMAIL_TABLA WHERE Tipo<=2 ORDER BY Fecha";
  13. $result = mysqli_query($con, $sql);
  14.  
  15. // an array to save the application data
  16. $rows = array();
  17.  
  18. // iterate to query result and add every rows into array
  19. while($row = mysqli_fetch_assoc($result)) {
  20. $rows[] = $row;
  21. }
  22.  
  23. // close the database connection
  24. mysqli_close($con);
  25.  
  26. // echo the application data in json format
  27. echo json_encode($rows);
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement