Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public class dbComponent {
- private var $dbhost;
- private var $dbname;
- private var $dbuser;
- private var $dbpass;
- function __construct($tdbhost,$tdbname,$tdbuser,$tdbpass) {
- $this->setDBHost($tdbhost);
- $this->setDBName($tdbname);
- $this->setDBUser($tdbuser);
- $this->setDBPass($tdbpass);
- $connect = mysql_connect($this->getDBHost(),$this->getDBUser(),$this->getDBPass()) or die(mysql_error());
- mysql_select_db($this->getDBName(),$connect);
- }
- public setDBName($name) { // Set database name?
- $this->dbname = $name;
- }
- public getDBName() { // Get database name then
- return $this->dbname;
- }
- public setDBHost($host) { // Set database host?
- $this->dbhost = $host;
- }
- public getDBHost() { // Get database host then
- return $this->dbhost;
- }
- public setDBUser($username) { // Set database username?
- $this->dbuser = $username;
- }
- public getDBUser() { // Get database username then
- return $this->dbuser;
- }
- public setDBPass($password) { // Set database password?
- $this->dbpass = $password;
- }
- public getDBPass() { // Get database password then
- return $this->dbpass;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment