开发者

Zend_Db_Table fetchAll and column names

开发者 https://www.devze.com 2022-12-17 08:13 出处:网络
I\'m testing Zen_DB and Zend_DB_Table and I\'m facing a problem: Let\'s say I\'ve got two tables table A(id, title)

I'm testing Zen_DB and Zend_DB_Table and I'm facing a problem:

Let's say I've got two tables

table A(id, title)

table B(id, title)

If I write something like

$db = $this->getDbTable()->getAdapter();  
$query = "SELECT A.*, B.* FROM A INNER JOIN B on A.id = B.id"  
$stmt = $db->query($query);  
$rows = $stmt->fetchAll();  

each resulting row is like ['id' => value, 'title' => value]

Question: How can the fetched rows be like ['A.id' => value, 'A.title' => value', 'B.id' => value, 'B.title' =>开发者_如何学C value'] ?

Important: I don't want to modify the database schema


Your question was answered by this question

0

精彩评论

暂无评论...
验证码 换一张
取 消