Advertisement
Guest User

Untitled

a guest
Jul 14th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. ["data","pre database"][{"email":"thomas@wiregrass.edu","password":"test","fname":"Thomas","lname":"Cummings","phone":"5052030822","temppass":"15151","alert":"B"}]
  2.  
  3. <?php
  4.  
  5. $user = "ab73953_test";
  6. $pass = "H3@ther78";
  7. $db = "ab73953_testdb";
  8. $out = array('data', 'pre database');
  9. echo json_encode($out);
  10. $db = mysqli_connect('localhost', $user, $pass, $db) or die("did not work");
  11.  
  12.  
  13. $email=$_POST['username'];
  14. $email = "thomas@wiregrass.edu"; // testing
  15.  
  16. $qry = 'SELECT * FROM users WHERE email = "'. $email .'"' ;
  17.  
  18. $result = mysqli_query($db, $qry) or die(" did not query");
  19.  
  20. $count = mysqli_num_rows($result);
  21. $output = array();
  22. if($count > 0){
  23. while($row = mysqli_fetch_assoc($result))
  24. {
  25. $output[]=$row;
  26.  
  27. }
  28.  
  29. echo json_encode($output);
  30.  
  31. }
  32. else
  33. echo json_encode("Could not find user");
  34.  
  35. mysqli_close($db);
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement