I have a field in my form 'update_job' named as 'job_category',which is a dropdownlist and has been stored in main table as category_id,and the table is related to another table 'category'.
My first question is how to write the joint query to get the category as well:I have written code to get all data and it works fine:but how to write a join query to get the category as well?
//code//
public function actionDisplayJob()
{
if (isset($_GET['id'])) {
$id = $_GET['id'];
}
$model = DisplayJob::model()->find(array(
'select' => array('posted_by', 'title', 'key_skills'), "condition" => "id=$id"
));
$params = array('model' => $model);
$this->render('update', $params);
}
Second,What should I do to keep data selected in dropdown list from database while editng the data?