I’m trying to figure out how to display two tables in one view. I have a POSTS table and a USERS table. On the actionIndex(), I would like to show the post (title and excerpt) and the user (name). Currently for the controller PostsContoller I have:
public function actionIndex() {
$dataProvider = new CActiveDataProvider('PostsModel');
$this->render('index', array(
'dataProvider' => $dataProvider,
));
}
And honestly, I have no idea on where to go from there. What I trying to create is a:
SELECT * FROM tbl_posts JOIN tbl_users ON tbl_users.user_id = tbl_posts.post_author