2009年4月23日星期四

Re: [fw-db] Joining 2 tables


Maybe you should copy/paste the error message...
Try this : $select->setIntegrityCheck(false);
And FYI, the first array of the from method is useless cause alias and table name are the same.


On Sat, Apr 18, 2009 at 3:37 PM, Erdal YAZICIOGLU <erdal.yazicioglu@gmail.com> wrote:
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



--
Thomas VEQUAUD          http://thomas.vequaud.free.fr/
Expert EPITECH en Ingénierie Informatique
Tél : +33(0)6.50.39.28.10  Fax: +33(0)9.58.46.10.07

没有评论: