i have 2 tables in db. i want to search and display the details. how i will display the details… i don’t no my code is right or not… give me some suggestions. here my code is…
$criteria = new CDbCriteria(); //create new object for search function
if(isset($_GET['q'])) //if value of search is set
{
$q = $_GET['q']; //assign search box value to variable
//var_dump($q);exit;
//var_dump($criteria->compare('user_name', $q, true, 'OR'));exit;
$criteria->compare('id', $q, true); //compare model attributes to search value
$criteria->compare('user_name', $q, true); //compare model attributes to search value
}
$model=new CActiveDataProvider("StudentTbl", array('criteria'=>$criteria)); //load the model
//var_dump($model);exit;
$this->render('index',array(
'model'=>$model,
));