문제

I'm using two radiobuttons in advanced search form, they are approved and rejected. When I click on approved it should filter for multiple search box in Gridview and display the result. There are other three fields 'Updated date','reviewed date' and 'created date' also. Suppose, I click on the approved button. It should check for the condition updated time is greater than created date and reviewed date is NOT NULL and display the results.

SQL query-Select * from test where (updateddate>createddate)and(revieweddate!=NULL) and approved=1

For rejected, the same needs to be done with approved=0 I have done the following to radiobuttons in advanced search form.

<div class="row"> 
<?php echo $form->radioButtonList($model, 'Approved', 
        array('0' => 'Rejected', '1' => 'Approved')
    ); ?> 
</div> 

How can I get the values of all the rows which satisfy the above criteria.

도움이 되었습니까?

해결책

You can use "$criteria->condition" like this:

$criteria->condition = ' (updateddate > createddate) AND (revieweddate IS NOT NULL) and approved = 1 ';
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top