Yii search method get don't work and don't compare with data in database

后端 未结 1 1060
轻奢々
轻奢々 2021-01-28 22:51

Hi yesterday i tried one way to create search by datetime, and you can see link: Search task on the next post. Today I try one another way: When I succed i will put sollution ba

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-28 23:37

    1) In your controller you should set the scenario as "search" like this

     $model = new Datalist('search');
     $model->unSetAttributes();
    

    2) You need to assign the $_GET values to the model before view is rendered like this

    // If your get vars are different then accordingly
    if(isset($_GET['AppLog'])){
         $model->attributes = $_GET['AppLog'];
    
    ....
      $model->date_to = $date_to // After you retrieved and formatted from $_GET as above 
      $model->date_from = $date_from
    

    Your controller action does not seem to rendering a view; i am assuming that you have omitted it here, but you are displaying the output in someway

    0 讨论(0)
提交回复
热议问题