Advertisement
Guest User

Untitled

a guest
Jun 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. <?php
  2.  
  3. $con = mysql_connect(yourdatabaseaddressprobablylocalhost,yourusername,yourpassword);
  4. if (!$con)
  5. {
  6. die('Could not connect: ' . mysql_error());
  7. }
  8.  
  9. mysql_select_db(yourdatabasename, $con);
  10.  
  11.  
  12. $result = mysql_query(yourmysqlquery);
  13. while($row = mysql_fetch_assoc($result)){
  14. $output[]=$row;
  15. }
  16. print(json_encode((array('arrayname'=> $output))));
  17.  
  18. mysql_close($con);
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement