Query Method

The query method is used for getting the result from a completed SQL command.

Basic Usage

Here is the basic usage query method from $db property on SENE_Model class.

$this->db->query(string $sql): boolean


This method has 1 required parameter.


The $sql value can be a completed single command of SQL.


Here is the example for query method in a model class.

class Blog_Model extends SENE_Model{
  var $tbl = 'd_blog';
  var $tbl_as = 'dbl';
  public function __construct(){
  public function getLatePublish($id){
    $sql = 'SELECT `title`, `pubdt` AS 'datePublished'
    FROM '.$this->tbl.' '.$this->tbl_as.'
    WHERE is_published = 1
    ORDER BY cdate DESC
    LIMIT 0,1;';
    return $this->db->query($sql);