Advertisement
Guest User

Untitled

a guest
Jun 13th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_connection(){
  2. static $connection = null;
  3.  
  4. if($connection){ return $connection; }
  5. $username= '';
  6. $password = '';
  7. ...
  8.  
  9. $connection = mysqli_connect();
  10.  
  11. return $connection
  12. }
  13.  
  14. function get_tests(){
  15. $CONNECT = get_connection();
  16. $res = mysqli_query($CONNECT, "SELECT * FROM `test`");
  17. if(!$res) return;
  18. $data = array();
  19. while($row = mysqli_fetch_assoc($res)){
  20. $data[] = $row;
  21. }
  22. return $data;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement