Forum Moderators: coopster
/////////////////////////////////////////////
class DB {
function DB() {
$this->host = "localhost";
$this->db = "database";
$this->user = "username";
$this->pass = "password";
$this->link = mysql_connect($this->host, $this->user, $this->pass);
mysql_select_db($this->db);
}
function close() {
mysql_close($this->link);
}
}
///////////////////////////////////////////////
To use it.
$sql="A query goes here";
$open_db = new DB; // Opens the connection
$result=mysql_query($sql);
$open_db.close; // Closes the connection
////////////////////////////////
In the error log...
[error] PHP Notice: Use of undefined constant close - assumed 'close' in /web1/www.user.com/admin/item/add.php on line 57
//////////////////////////////
TIA