0

我是 zend 框架的新手,需要在 zend 控制器的函数中定义两个 mysql 查询,但它显示

错误消息为消息:SQLSTATE [42000]:语法错误或访问冲突:1065 查询为空

public function addisplayAction()
  {

    $registry = Zend_Registry::getInstance();  
$DB = $registry['DB'];

   $sql = "SELECT cateno,catename,image FROM hl_category ORDER BY`hl_category`.`cateno` ASC LIMIT 0 , 42";
      $result = $DB->fetchAssoc($sql);
    $sql1 = mysql_query("select * from ad where cid=8");
   $result1 = $DB->fetchAssoc($sql1);
  $this->view->assign('title','Member List');
      $this->view->assign('description','Below, our members:');
       $this->view->assign('datas',$result);    
  $this->view->assign('datas1',$result1);   
4

1 回答 1

0

我的天啊!!!!您正在使用 Zend 框架并输入您的代码 mysql_query() ???? :D

您需要使用 Zend_Db ...

http://framework.zend.com/manual/1.11/en/zend.db.html

于 2012-05-24T20:08:01.703 回答