Zend Framework中的Zend_Db不支援模糊查詢?解決思路

來源:互聯網
上載者:User
Zend Framework中的Zend_Db不支援模糊查詢???
Zend Framework中的Zend_Db是不是不支援like查詢...
下面為我的主要代碼:
PHP code
class Dtstockgrade extends Zend_Db_Table_Abstract {        protected $_name = 'dtstockgrade';    protected $_db;        public function init(){                $this->_db=$this->getAdapter();        }        public function getListSize($classid='',$author='',$stockcode='',$title='',$time=''){        if(strlen($classid)>1){            $where=" classid='".$classid."'";        }else{            $where=" createtime > '".$time."'";            if(strlen($author)>1){                $where.=" and author like '%".$author."%' ";            }            if(strlen($stockcode)>1){                $where.=" and stockcode='".$stockcode."' ";            }            if(strlen($title)>1){                $where.=" and title like '%".$title."%' ";            }        }        $sql="select count(*) as total from  dtstockgrade where $where";        //file_put_contents("d://a.txt",$sql);         $sql=$this->_db->quoteInto($sql,'');        $result=$this->_db->query($sql);        $result=$result->fetchAll();        return $result;    }}



我用這個代碼產生的sql語句在資料庫中是對的
可是當我的sql語句中存在like時,就沒有得到資料了,可是sql語句在資料庫總執行時是有資料的
急急.....
是 不是zend Framework不支援模糊查詢還是My Code寫的不對????
那位大俠看哈.....

------解決方案--------------------
恭喜了,jf
------解決方案--------------------
字元集設定的原因。
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.