yii问题

WBOY
WBOYOriginal
2016-06-23 13:30:45889browse



实现按条件查询

控制器:(display 和 title 已经实现)
 if(isset( $_POST['Cg_display']) && $_POST['Cg_display']!=""){
            $_GET['News']['display'] =$_POST['Cg_display'] ;
        }
        if(isset( $_POST['title']) && $_POST['title']!=""){
            $_GET['News']['title'] =$_POST['title'] ;
        }

日期:显示两个日期的数据

if(isset( $_POST['date1']) && $_POST['date1']!=""){            $_GET['News']['date'] =$_POST['date1'] ;        }   if(isset( $_POST['date2']) && $_POST['date2']!=""){            $_GET['News']['date'] =$_POST['date2'] ;        }//这个功能无法实现    查询两个日期间的数据


回复讨论(解决方案)

这种就是sql语句的拼接了。。 搜索时间>开始时间 

谁告诉你Yii是这么玩的?
你这是1还是2?
1就建议你看看 http://www.yiichina.com/doc/api/1.1/CDbCriteria
2就建议你看看http://www.yiichina.com/doc/api/2.0/yii-db-activequery

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn