Mysql fetchRow()Zend框架中的简单SQL语法错误

Mysql fetchRow()Zend框架中的简单SQL语法错误,mysql,zend-framework,syntax,row,fetch,Mysql,Zend Framework,Syntax,Row,Fetch,我得到了这样一个简单的指示: $db = Zend_Db_Table::getDefaultAdapter(); $select = $db->select(); $select ->from(array("b" => "barcos")) ->join(array("i" => "imagens"), 'b.id = i.barcoId') ->where("b.id = {$idEmbarcacao}

我得到了这样一个简单的指示:

    $db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select();
$select
        ->from(array("b" => "barcos"))
        ->join(array("i" => "imagens"), 'b.id = i.barcoId')
        ->where("b.id = {$idEmbarcacao}")
        ->group("i.barcoId");

$this->view->anuncio = $db->fetchRow($select);
它返回这个错误

Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
这让我抓狂,因为只有在这个特定的页面上它才会返回这个错误,而在其他一些页面上它是可以的。我的数据库已正确填充。它应该返回一些东西,但不是一个错误。提前谢谢。

请这样试试

$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select();
$select
        ->from(array("b" => "barcos"))
        ->join(array("i" => "imagens"), 'b.id = i.barcoId')
       // ->where("b.id = {$idEmbarcacao}")
        ->where("b.id = ?", $idEmbarcacao)
        ->group("i.barcoId");

$this->view->anuncio = $db->fetchRow($select);

您可以使用
->where(“b.id=?”,$idembarcaco)
而不是
->where(“b.id={$idembarcaco}”)

Fernando,您能打印ZF_Db创建的最终SQL吗?