Created
March 21, 2011 04:20
-
-
Save rjayako/879007 to your computer and use it in GitHub Desktop.
Database query object
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 JetBrains PhpStorm. | |
* User: ryanjayakody | |
* Date: 11-03-09 | |
* Time: 3:52 PM | |
* To change this template use File | Settings | File Templates. | |
*/ | |
include("config.ini"); | |
class Database | |
{ | |
private $host = HOST; | |
private $user = USER; | |
private $pass = PASS; | |
private $database = DATABASE; | |
private $db = NULL; | |
public $result = NULL; | |
public $numRow = NULL; | |
public $assocResult = 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 numRows($result) | |
{ | |
$numRow = mysql_num_rows($result); | |
return $numRow; | |
} | |
public function __destruct() | |
{ | |
$this->result = NULL; | |
$this->numRow = NULL; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment