Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class mysqlclass
- {
- private $_host;
- private $_user;
- private $_pass;
- private $_name;
- private $_query;
- private $_con;
- private $_conta;
- public function __construct($host_db, $user_db, $pass_db, $name_db)
- {
- $this->_host = $host_db;
- $this->_user = $user_db;
- $this->_pass = $pass_db;
- $this->_name = $name_db;
- }
- public function connect()
- {
- $this->_con = mysql_connect($this->_host , $this->_user , $this->_pass) or die(mysql_error());
- mysql_select_db($this->_name , $this->_con) or die(mysql_error());
- }
- public function query($query)
- {
- $this->_query = $query;
- return mysql_query($this->_query) or die(mysql_error());
- }
- public function conta($query1)
- {
- $this->_conta = $query1;
- return mysql_num_rows($this->_conta) or die (mysql_error());
- }
- public function __destruct()
- {
- mysql_close($this->_con);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment