<?
include('config.php');
class ResultSet {
private $result;
public function __construct($result) {
$this->result = $result;
}
public function next() {
return mysql_fetch_array($this->result);
}
public function size() {
return mysql_num_rows($this->result);
}
}
class MySQL {
// Attribute
private $connect;
private $host = 'localhost';
private $mysql_username = 'root';
private $mysql_password = '123';
private $mysql_db = 'classified_bank';
public function __construct() {
$this->connect = mysql_connect($this->host,$this->mysql_username,$this->mysql_password) or die(mysql_error());
mysql_query("SET NAMES UTF8");
mysql_select_db($this->mysql_db, $this->connect);
}
public function query($sql) {
$ret = mysql_query($sql);
if (!$ret) {
die(mysql_error());
}
return new ResultSet($ret);
}
public function querynoreturn($sql) {
$ret = mysql_query($sql);
if (!$ret) {
die(mysql_error());
}
}
public function Size($sql) {
$ret = mysql_query($sql);
if (!$ret) {
die(mysql_error());
}else{
return mysql_num_rows($ret);
}
}
public function getLastInsertId() {
return mysql_insert_id();
}
public function __destruct() {
if ($this->connect) {
mysql_close($this->connect);
}
}
public function query_insert($sql) {
$ret = mysql_query($sql);
if (!$ret) {
die(mysql_error());
}
}
}
?>