关于模糊查询中的字符串问题

浏览:1462 发布日期:2016/03/24 分类:求助交流 关键字: 查询
<?php
// 本类由系统自动生成,仅供测试用途
class SearchAction extends Action {
    public function index(){
    $this->display();
    }
    public function search(){
        $count=$_POST['count'];
        $Message=M('message');//连接数据库
         //查询条件
        //$where['title']=array("like","'$count'");
        //$where['content']=array("like","'$count'");
       $where['_string']='(content like "%'.$count.'%")  OR (title like "%'.$count.'%")'; //
        $Mess=$Message->where($where)->select();
        //$Mess=mysql_query($sql);
        dump($Mess);
    }
}
<!DOCTYPE html>
<html>
<head>
    <title>文件搜索</title>
    <load href="__PUBLIC__/Css/search.css"/>
</head>
<body>
<form name="count" method="POST" action="__APP__/Search/search">
<div><input class="inp"></input><input class="inp_1" type="submit" value="搜索文件"></input></div>
</form>
<br/><br/><br/>
<hr/>
</body>
</html>
怎么在模糊查询中加入变量$count
最佳答案
评论( 相关
后面还有条评论,点击查看>>