2009年4月18日星期六

[fw-db] Joining 2 tables

Hi all,

I am trying to join two tables but I could not figure out how to do that. My
code is below. Any help is appriciated.

Thanks

$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$id = $user->user_ID;
$inbox = new Inbox();
$select = $inbox->select()
->from(array('mail_Inbox'=>'mail_Inbox'),array('messageID','receiverID','senderID','date','messageTitle','message','messageRead'))
->join(array('dict_Alumni'=>'dict_User'),'mail_Inbox.senderID=dict_User.user_ID',array('user_ID','user_Name'))
->where('mail_Inbox.receiverID = ?',$id);
$this->view->inbox = $inbox->fetchAll($select);

Then it returns error...

Any ideas welcome

Erdal YAZICIOGLU
Field Project Engineer Manager
Page Europa
A GENERAL DYNAMICS COMPANY
Ras Laffan Industrial City
Doha, Qatar
Mobile: +974 325 4429

没有评论: