php - Yii $criteria->addBetweenCondition not Working in CDbCriteria


I want to get results of sender score between 1 to 10,So I have add this condtion.


sender_score is my table field, senderscore_start and senderscore_end are only public variables.

My Search From Code:

<div >    
  <?php echo $form->label($model,'senderscore_start'); ?>
  <?php echo $form->textField($model,'senderscore_start',array('size'=>60,'maxlength'=>100,'style'=>'width:300px;')); ?>   
<div >    
  <?php echo $form->label($model,'senderscore_end'); ?>
  <?php echo $form->textField($model,'senderscore_end',array('size'=>60,'maxlength'=>100,'style'=>'width:300px;')); ?>    

My Model Code:

public $senderscore_start;
public $senderscore_end;

array('senderscore_start,senderscore_end', 'safe', 'on'=>'search'),


But not showing results between 1,10 , can you look at this please! what's wrong with my code. `




You should not access any request variables like$_GET from inside your models. So the correct solution would be:

$criteria->addBetweenCondition('sender_score',$this->senderscore_start, $this->senderscore_end);



Try this!


People are also looking for solutions to the problem: apache - How to properly increase PHP script execution time


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.