<?PHP
class Database {
public $_dbLocation = "localhost";
public $_dbUser = "user";
public $_dbPass = "pass";
public $_dbName = "dbname";
public $_dbr = null;
public $_sql = "";
public $_sql_res = null;
public $_resource = null;
public $_error = null;
public function __construct( $new = false ) {
if ($this->_resource
= @mysql_connect($this->_dbLocation
, $this->_dbUser
, $this->_dbPass
, $new)) { $this->_error = " Could not connect to database !";
return NULL;
}
}
$this->_error = NULL;
}
public function __destruct()
{
}
public function haveError() {
if ( $this->_error == NULL ) {
return FALSE;
}
return TRUE;
}
public function getLastId()
{
$rows = null;
return $rows;
}
/**
* selecting database
*
* @param string $database
*/
public function selectDb ($database) {
}
private function escape( $var ) {
} else {
//$var = @mysql_real_escape_string($var);
}
return $var;
}
/**
* Enter description here...
*
* @param SQL query $strQuery
* @param Database (optional) $database
* @return Error massage if exist
*/
public function query($strQuery, $database = '') {
$strQuery = $this->escape($strQuery);
$this->_sql_res = $strQuery;
$sql = false;
}
$this->_error = null;
return TRUE;
} else {
$this->_sql = null;
return FALSE;
}
}
public function gerErrorMsg()
{
return $this->_error;
}
/**
* Enter description here...
*
* @return Rows of query function ($this->query)
*/
public function fetchRow() {
if ( !$this->_sql || $this->_sql == null ) {
return null;
}
$rows = null;
return $rows;
}
/**
* Enter description here...
*
* @return List Array
*/
public function fetchArrayList() {
if ( !$this->_sql || $this->_sql == null ) {
return null;
}
$array[] = $row;
}
return $array;
}
/**
* Enter description here...
*
* @return Array of query function
*/
public function fetchArray() {
if ( !$this->_sql || $this->_sql == null ) {
return null;
}
return $row;
}
/**
* Enter description here...
*
* @return One value of query function
*/
public function fetchOne() {
if ( !$this->_sql || $this->_sql == null ) {
return null;
}
$res = null;
$res = $row[0];
}
return $res;
}
/**
* Enter description here...
*
* @return Object array of query function
*/
public function fetchObjectList() {
if ( !$this->_sql || $this->_sql == null ) {
return null;
}
$array[] = $row;
}
return $array;
}
public function fetchObject()
{
if ( !$this->_sql || $this->_sql == null ) {
return null;
}
return $row;
}
/**
* Enter description here...
*
* @return String of query yau have set if query function
*/
public function returnSql() {
}
}
?>