是不可能在zend帧工作控制器的函数中定义两个查询

时间:2012-05-24 11:03:30

标签: zend-framework

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

错误消息显示消息: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);   

1 个答案:

答案 0 :(得分:0)

OMG !!!!您正在使用Zend框架并将代码放入mysql_query()???? :d

您需要使用Zend_Db ...

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