Created
March 30, 2011 04:27
-
-
Save rjayako/893865 to your computer and use it in GitHub Desktop.
Database class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by Ryan J | [email protected] | |
* Date: | |
* Version : v1.1 | |
*/ | |
include("config.ini.php"); | |
class Database | |
{ | |
private $host = HOST; | |
private $user = USER; | |
private $pass = PASS; | |
private $database = DATABASE; | |
private $db = NULL; | |
public $result = NULL; | |
public $numRow = NULL; | |
public $query = NULL; | |
public function __construct() | |
{ | |
$this->db = mysql_connect($this->host, $this->user, $this->pass); | |
mysql_select_db($this->database, $this->db); | |
} | |
public function doQuery($query) | |
{ | |
$result = mysql_query($query, $this->db); | |
return $result; | |
} | |
public function getRows($query) | |
{ | |
$result = mysql_query($query,$this->db); | |
$numRow = mysql_num_rows($result); | |
return $numRow; | |
} | |
public function __destruct() | |
{ | |
$this->result = NULL; | |
$this->numRow = NULL; | |
$this->query = NULL; | |
mysql_close(this->$db); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment