note 102296 deleted from language.oop5.basic by danbrown
| From: | danbrown@php.net | Date: | Mon, 07 Feb 2011 14:21:00 +0000 |
| Subject: | note 102296 deleted from language.oop5.basic by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176738@lists.php.net to get a copy of this message | ||
Note Submitter: said9923 at gmail dot com
----
class dbConnect{
public $host = "localhost";
public $user;
private $pwd;
protected $name;
function dbConnect($dbHost, $dbUser, $dbPwd, $dbName)
{
$this->host = $dbHost;
$this->user = $dbUser;
$this->pwd = $dbPwd;
$this->name = $dbName;
}// Class Constructor Function
function Connect(){
$con = mysql_connect($this->host, $this->user, $this->pwd);
if($con)
{
mysql_select_db($this->name) or die(mysql_error());
}
return $con;
}
}
//Define variables required for database connection
$host = "localhost";
$user = "said";
$pwd = "";
$name = "";
//Instance of the dbConnect class
$Connect = new dbConnect($host, $user, $pwd, $name);
$Connect -> Connect();