Yii is a great web 2.0 php framework. Many time we have to execute mysql queries without call any model. This post explains about how to execute mysql query without using any model.
First create a db connection object
Create sql query
$sql = "SELECT id,username FROM users";
Pass it to create command function.
$command = $connection->createCommand($sql);
After it we can execute it by using query function.