note 102296 deleted from language.oop5.basic by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.