Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ////////////////////////////////////////////////////////////////
- //
- // Warning: Editing the following without instruction or
- // knowledge of how it works may lead to errors in its
- // execution, always consult me before editing any of this
- //
- // ~David A Perez
- //
- ////////////////////////////////////////////////////////////////
- // Retrieve DB connection information
- require_once'mysql_config.php';
- class mysql_lib{
- protected $dbhost;
- protected $dbusername;
- protected $dbpassword;
- protected $dbname;
- public $connect;
- ////////////////////////////////////////////////////////////////
- // Built it
- ////////////////////////////////////////////////////////////////
- public function __construct(){
- global $db_host;
- global $db_username;
- global $db_password;
- global $db_dbname;
- $this->dbhost = $db_host;
- $this->dbusername = $db_username;
- $this->dbpassword = $db_password;
- $this->dbname = $db_dbname;
- }
- /////////////////////////////////////////////////////////////////////////////////
- // MySQL Methods
- /////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////
- // Open connection
- ////////////////////////////////////////////////////////////////
- public function open_connect(){
- $this->connect = mysql_connect($this->dbhost,$this->dbusername,$this->dbpassword);
- if(!$this->connect){
- die('Error connecting to MySQL: '.mysql_error());
- }
- mysql_select_db($this->dbname,$this->connect);
- }
- ////////////////////////////////////////////////////////////////
- // Close Connection
- ////////////////////////////////////////////////////////////////
- public function close_connect(){
- mysql_close($this->connect);
- }
- }
- ?>
Add Comment
Please, Sign In to add comment