Advertisement
Guest User

example mariadb with msql support(mysqli)

a guest
Dec 25th, 2017
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. {
  2. $this->db_addr = $db_addr;
  3. $this->db_user = $db_user;
  4. $this->db_pass = $db_pass;
  5.  
  6. $this->querycount = 0;
  7.  
  8. if ( $use_pconnect )
  9. {
  10. $this->link = @mysqli_connect("p:".$db_addr, $db_user, $db_pass);
  11. }
  12. else
  13. {
  14. $this->link = @mysqli_connect($db_addr, $db_user, $db_pass);
  15. }
  16.  
  17. if ( $this->link )
  18. {
  19. $q = @mysqli_query($this->link, "SET NAMES 'utf8'");
  20. @mysqli_free_result($q);
  21. if ( $db_name != '' )
  22. {
  23. $this->db_name = $db_name;
  24. if ( !@mysqli_select_db($this->link, $db_name) )
  25. {
  26. @mysqli_close($this->db_connect_id);
  27. $this->error("Could not select database '$db_name'. Check that the value of DB_NAME in config.php is set correctly.");
  28. }
  29. }
  30. return $this->link;
  31. }
  32. else
  33. {
  34. $this->error('Could not connect to database server. Check that the values of DB_ADDR, DB_USER and DB_PASS in config.php are set correctly.');
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement