<?php
class Database
{
private $host;
private $user;
private $pwd;
private $db;
private $conn;
public function __construct()
{
$this->host='localhost';
$this->user='root';
$this->pwd='root';
$this->db='shopcart';
}
public function Connect()
{
$this->conn=mysql_connect($this->host,$this->user,$this->pwd);
if(!$this->conn)
trigger_error('Cannot Connect to Server');
else
$this->SelectDatabase($this->conn);
}
private function SelectDatabase($conn)
{
$db=mysql_select_db($this->db,$conn);
if(!$db)
trigger_error('Cannot Select Database');
}
}
?>