Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class database {
- var $hostname;
- var $username;
- var $password;
- var $database;
- var $conn;
- function set($host, $user, $pass, $db) {
- $this->hostname = $host;
- $this->username = $user;
- $this->password = $pass;
- $this->database = $db;
- }
- function connect() {
- $this->conn = mysql_connect($this->hostname, $this->username, $this->password)
- or die("Could not connect to database: " . mysql_error());
- mysql_select_database($this->database)
- or die("Could not select database: " . mysql_error());
- }
- function query($query) {
- mysql_query($query) or die("Mysql error: " . mysql_error());
- }
- function close() {
- mysql_close($conn);
- }
- }
Add Comment
Please, Sign In to add comment