Created
July 13, 2015 01:35
-
-
Save nikartx/0ec4643bfd62963b330e to your computer and use it in GitHub Desktop.
Connect to DB MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DB_CONNECT { | |
function __construct() { | |
$this->connect(); | |
} | |
function __destruct() { | |
$this->close(); | |
} | |
function connect() { | |
require 'db_config.php'; | |
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error()); | |
$db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error()); | |
return $con; | |
} | |
function close() { | |
mysql_close(); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment