$sql="SELECT * FROM hotel AS p, hotel_room AS q WHERE `Image` LIKE '%No_Image%' AND p.id=q.id";
$rows=Yii::app()->db->createCommand($sql)->queryAll();
var_dump($rows); //an array of your record rows
You should prepare the db-data in the controller or maybe a helper class with static methods.
class DbData {
public static function getHaveImageDropDownData()
{
$sql="SELECT * FROM hotel AS p, hotel_room AS q WHERE `Image` LIKE '%No_Image%' AND p.id=q.id";
$rows=Yii::app()->db->createCommand($sql)->queryAll();
return CHtml::listData($rows, ....);
}
...
}
Take the tutorials(definitiv guide, blog tutorial,…) as starting point.
There you always have the links to the classes reference. It’s very important to know the classes and methods and how they can help you to implement your solutions.
Maybe a Yii book is a good choice too.
I did PHP programming a lot of years without a framework.
I didn’t like the existing, but I was happy when I detected Yii.
It’s worth to start from scratch, but it’s worth every minute
It speeds up coding a lot and helps you to generate clean code if you know how to …