- Seme Framework
- version 4.0.3
- Requirements
- Download & Install
- Configuration
- Tutorials
- URI Routing
- Constants
- Global Variables
- Model
- View
- Controller
- cdn_url
- config
- constructor
- getAdditional
- getAdditionalBefore
- getAdditionalAfter
- getAuthor
- getCanonical
- getContentLanguage
- getDescription
- getIcon
- getJsContent
- getJsFooter
- getJsReady
- getKey
- getKeyword
- getLang
- getRobots
- getShortcutIcon
- getThemeElement
- getTitle
- input
- lib
- load
- loadCss
- loadLayout
- putThemeContent
- putJsContent
- putJsFooter
- putJsReady
- putThemeContent
- render
- resetThemeContent
- session
- setAuthor
- setCanonical
- setContentLanguage
- setDescription
- setIcon
- setKey
- setKeyword
- setLang
- setShortcutIcon
- setTheme
- setTitle
- Library
- CLI (command line interface)
- Core
- Issue
- Deployment
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
Parameters
This method has 1 required parameter.
$sql
The $sql value can be a completed single command of SQL
.
Example
Here is the example for query
method in a model class.
<?php
class Blog_Model extends SENE_Model{
var $tbl = 'd_blog';
var $tbl_as = 'dbl';
public function __construct(){
parent::__construct();
$this->db->from($this->tbl,$this->tbl_as);
}
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);
}
}