24/07/2013
This is my database class, which I use to fetch my queries and results. Let me know if you use it. Or if you have a better version.
/*
* class database
*/
class dBase {
var $connect;
function connect($host, $user, $pass, $db) {
$this->connect = mysql_connect($host, $user, $pass);
mysql_select_db($db, $this->connect);
}
function query($sql) {
return mysql_query($sql, $this->connect);
}
function rows($sql) {
return mysql_num_rows($this->query($sql));
}
function __destruct() {
mysql_close($this->connect);
}
}