Marek Wawro wrote:
> 
> $select = $ct->select();
> $select->from($ct, 'MAX(place_id) as max_id')->where('shop_id = ?', 0)- 
>  >group('shop_id');
> $max = $ct->fetchRow($select);
> 
> When i am trying to read $max->max_id i am getting exception that this  
> column is not existing
> 

I just tried the code that you gave above, and it works for me and gives no
errors.  I'm using ZF 1.5 from the trunk, on Windows XP with PHP 5.2.5.

I believe you have left something out of your description of the issue.

Regards,
Bill Karwin

<?php
require_once 'Zend/Db.php';
require_once 'Zend/Db/Table/Abstract.php';

$db = Zend_Db::factory('mysqli', array('dbname'=>'test', 'username'=>'root',
'password'=>'root'));

// table `ct` exists in MySQL test database and has sample data
class ct extends Zend_Db_Table_Abstract { }

$ct = new ct($db);

$select = $ct->select();
$select->from($ct, 'MAX(place_id) as max_id')->where('shop_id = ?',
0)->group('shop_id');
$max = $ct->fetchRow($select);

print_r($max->toArray()); // array contains [max_id] => 4

print "max_id = " . $max->max_id . "\n"; // no error

$max->max_id = 24; // no error (but don't try to save this change)

-- 
View this message in context: 
http://www.nabble.com/Zend_Db_Table-I-have-problems-reading-columns%27-alliases-tp15779311s16154p15780855.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to