Home  >  Article  >  Backend Development  >  zendframework中文字段开展筛选,取不出mysql中文字段,英文和数字字段都可以

zendframework中文字段开展筛选,取不出mysql中文字段,英文和数字字段都可以

WBOY
WBOYOriginal
2016-06-13 13:16:301244browse

zendframework中文字段进行筛选,取不出mysql中文字段,英文和数字字段都可以
以下是IndexController.php控制器部份,这部份用中文字段进行筛选,无法取出记录

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php require_once 'Zend/Controller/Action.php';
require_once 'application/models/goods.php';
require_once 'application/models/db.php';
require_once 'BaseController.php';


    class IndexController extends BaseController
    {
        
        function indexAction()
        {
            $this->view->title='aaaa';                    
            $goods=new goods();        
            $dbs=$goods->getAdapter();//适配器查询返回的数据是数组        
            $cname="索尼高性价比入门单反  A580 单反相机【演示数据】";
            $res=$dbs->query("select * from shopnc_goods where goods_name=".$dbs->quote($cname)." limit 0,9")->fetchAll();    
            echo "<pre class="brush:php;toolbar:false">";
            print_r($res);
            echo "
"; exit(); } }


------解决方案--------------------
确认表中确有此串
确认编码没有搞错
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