I am using this method to fetching the Rows from the database and showing on the frontend
but when it execute it is giving a fatel error that is
Fatal error: Call to a member function getRow() on a non-object in D:\xampp\htdocs\Deshbandhu\class\tblOp.php on line 432
and the function code which I am using that is
function getRowFields($fields,$where = NULL, $order = NULL){
global $db;
$fields = ($fields) ? " $fields " : " * ";
$where = ($where) ? " WHERE $where " : "";
$order = ($order) ? " ORDER BY $order " : " ORDER BY {$this->primaryKey} ";
$sql = "SELECT $fields FROM {$this->table} $where $order;"; // limit 0,1
$res =$db ->getRow($sql, DB_FETCHMODE_ASSOC);
echo $res; exit;
if (DB::isError($res))
return $this->raiseError($res);
return $res;
}
and the defination of the getRow() are
function getRow($where = NULL, $order = NULL,$fields=NULL){
global $db;
$sql = $this->buildQuery(NULL, TBLOP_EXECUTE_SELECT, $where, $order,$fields);
//echo $sql.'<br>';
$res = $db->getRow($sql, DB_FETCHMODE_ASSOC);
if (DB::isError($res))
return $this->raiseError($res);
return $res;
}
this code is running on live server and not giving any error but when I execute it on local server it is showing error like this.