Yii Select query


Yii Select query Syntax And Example : Yii Query builder is used to select records from table.


Syntax : Yii Select query

$results = Yii::app()->db->createCommand()
    ->select('id,name, email')
    ->from('users')
    ->where('id=:id', array(':id'=>$id))
    ->queryRow();

Which will result the row where id is equal to $id. The above query will produce the following result.

//Select id,name, email from users where id = “5”

where $id = 5;


Advertisements

Add Comment

📖 Read More