<?php
require("const.php"
;
class mysql{
public $connection;
public function mysql(){
$this->connection = mysql_connect(db_host, db_user, db_pass) or die(mysql_error());
mysql_select_db(db_data, $this->connection) or die(mysql_error());
}
function query($query){
return mysql_query($query, $this->connection);
}
};
/* Create database connection */
$database = new mysql;
?>
const.php
<?php
//define for datasbase
define("db_user", "root"
;
define("db_pass", ""
;
define("db_host", "localhost"
;
define("db_data", "journal"
;
?>
or
<?php
$host = ' ';
$user = ' ';
$pass = ' ';
$db = ' ';
$q = mysql_connect($host, $user, $pass) or die("Couldn't Connect To Datebase"
;
mysql_select_db($db, $q) or die("Couldn't Select DataBase"
;
?>