Location: PHPKode > scripts > How to Connect MySQL with PHP > connect_db.php
<?php
class connect_db {
	function DB() {
		$this->host = "'localhost'"; //MySQL Host
		$this->db = "SourceDB"; //MySQL Database
		$this->user = "SourceUser"; //MySQL User
		$this->pass = " SourcePass"; //MySQL Password
		$this->link = mysql_connect($this->host, $this->user, $this->pass);
		mysql_select_db($this->db);
		register_shutdown_function(array(&$this, 'close'));
	}
	
	function query($query) {
		$result = mysql_query($query, $this->link);
		return $result;
	}
	
	function close() {
		mysql_close($this->link);
	}
}
?>
Return current item: How to Connect MySQL with PHP