> Hi,
>
> I don't know exactly your problem with raw query. But with instance of
> Zend_Db_Table_Abstract, most of time, people forget to explicitly declare
> the from() part.
>
> Example:
> $table = new Members();
> $select = $table->select();
> $select->from($this);
> $select->join('groups', 'members.group_id=groups.id', 'groups.name');
> $rows = $table->fetchAll($select);||
You don't need to do ->from() in this case unless you need to query a
different table, etc.. and then it's (IMHO) cleaner to do $db =
$this->getAdapter(); $db->select()->etc()->pp().. If you stay on the
same table the from() is implied.
Till
没有评论:
发表评论