Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql Zend 2 sql查询问题_Mysql_Sql_Database_Zend Framework_Pdo - Fatal编程技术网

Mysql Zend 2 sql查询问题

Mysql Zend 2 sql查询问题,mysql,sql,database,zend-framework,pdo,Mysql,Sql,Database,Zend Framework,Pdo,3框架,想做简单的sql。我有这样的函数,但问题是我输出 选择列表。*从列表中,列表_id='1'限制'1'我不想要在选择后的第一个列表,我想要所有列 static $tableName = 'listings'; public function getListingsById($id){ $select = new Select(); $select->from(self::$tableName); $where = new Where(); $whe

3框架,想做简单的sql。我有这样的函数,但问题是我输出 选择列表。*从列表中,列表_id='1'限制'1'我不想要在选择后的第一个列表,我想要所有列

static $tableName = 'listings';

public function getListingsById($id){

    $select = new Select();
    $select->from(self::$tableName);
    $where = new Where();
    $where->equalTo('listings_id', $id);
    $select->where($where);
    $select->limit(1);

    echo $select->getSqlString($this->getAdapter()->getPlatform());
    return $this->selectWith($select);
}
SELECT listings.*FROM listings与SELECT*FROM listings相同-两者都将提供该表中的所有列