Guest User

Untitled

a guest
Jul 23rd, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2. class mysqlclass
  3. {
  4. private $_host;
  5. private $_user;
  6. private $_pass;
  7. private $_name;
  8. private $_query;
  9. private $_con;
  10. private $_conta;
  11.  
  12. public function __construct($host_db, $user_db, $pass_db, $name_db)
  13. {
  14. $this->_host = $host_db;
  15. $this->_user = $user_db;
  16. $this->_pass = $pass_db;
  17. $this->_name = $name_db;
  18. }
  19.  
  20. public function connect()
  21. {
  22. $this->_con = mysql_connect($this->_host , $this->_user , $this->_pass) or die(mysql_error());
  23. mysql_select_db($this->_name , $this->_con) or die(mysql_error());
  24. }
  25.  
  26. public function query($query)
  27. {
  28. $this->_query = $query;
  29. return mysql_query($this->_query) or die(mysql_error());
  30. }
  31.  
  32. public function conta($query1)
  33. {
  34. $this->_conta = $query1;
  35. return mysql_num_rows($this->_conta) or die (mysql_error());
  36. }
  37.  
  38. public function __destruct()
  39. {
  40. mysql_close($this->_con);
  41. }
  42. }
  43.  
  44. ?>
Add Comment
Please, Sign In to add comment