Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2. function resultToArray($result) {
  3.     $rows = array();
  4.     while($row = $result->fetch_assoc()) {
  5.         $rows[] = $row;
  6.     }
  7.     echo json_encode($rows);
  8. }
  9. $mysqli = new mysqli("host", "user", "password", "db_to_use");
  10. $email = $_GET['email'];
  11. $query = ("SELECT * FROM Cards WHERE Email_FK='{$email}'");
  12. $result = $mysqli->query($query);
  13. $rows = resultToArray($result);
  14. var_dump($rows);
  15. //echo json_encode($rows);
  16. $result->free();
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement