on CI was pretty simple :
$query = $this->db->get(‘table_name’, 10, 20);
$this->db->select(‘name, username, email’);
$query = $this->db->get(‘users’);
$this->db->where(‘name’, $name);
how to do this on YII ?>!
on CI was pretty simple :
$query = $this->db->get(‘table_name’, 10, 20);
$this->db->select(‘name, username, email’);
$query = $this->db->get(‘users’);
$this->db->where(‘name’, $name);
how to do this on YII ?>!
In most cases you’d create an Active Record: guide.
For more complex queries, or if you’d like to write sql you can use data access objects: guide.
Example on the latter:
$connection=Yii::app()->db;
$sql = 'SELECT * FROM tbl_mytable LIMIT 10,20';
$command=$connection->createCommand($sql);
$rows=$command->queryAll();