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
------解決方案--------------------
字元集設定的原因。