php - I cant select data with condition using yii framework -


i new in yii.i trying select data database , list it.i have controller name sitecontroller.php , view page search_result.php.i can select , list data without condition,but want select data condition

controller - sitecontroller.php

<?php class sitecontroller extends controller    {  public function actionsearch_result()   {     $title=$_get['title'];     $experience=$_get['experience'];     $criteria=new cdbcriteria(); $criteria->condition = "title '%$title%' or  key_skills '%$title%'";     $count=job::model()->count($criteria);     $pages=new cpagination($count);     $pages->pagesize=2;     $pages->applylimit($criteria);     $model=job::model()->findall($criteria);     $this->render('search_result',array('model' =>$model,'pages' => $pages));    } } 

?>

my view file - search_result.php

<div style="float:right;margin-right:285px;">  <h1>search results</h1> <ul style="list-style:none; ">  <?php foreach($model $models)     {   $job_id=$models->id;  ?>   <li><p><?php echo $models->title; ?></p>   <p><?php echo $models->company_name   ; ?></p>   <p><?php echo $models->description    ; ?></p>   <p>keyskill:<?php echo $models->key_skills    ; ?><p>     </li>    <?php    }    ?>    </ul>        <p><?php $this->widget('clinkpager', array(    'pages' => $pages,   )) ?></p>      </div> 

anybody me?

replace code code -

$criteria->condition = "title '%$title%' or  key_skills '%$title%'";  $criteria->condition = "title '%$title%' or  key_skills '%$title%'"; 

in place of "c" use "c".


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -