Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "votebus_madpad";
  4. $password = "BtqT8g&PRf#p";
  5. $dbname = "votebus_db";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. $sql = "SELECT * from orders ";
  15. $result = $conn->query($sql);
  16.  
  17. if ($result->num_rows > 0) {
  18. // output data of each row
  19. while($row = $result->fetch_assoc()) {
  20. print json_encode($row, JSON_PRETTY_PRINT);
  21.  
  22.  
  23. }
  24.  
  25. } else {
  26. echo "0 results";
  27. }
  28. $conn->close();
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement