Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-22-2007, 07:01 AM
Junior Member
 
Join Date: Aug 2007
Posts: 6
Red face How can I show content of two tables

Hello,

I don't know, why I didn't get a reply to my first quest.
Perhaps it was to complicate, so I will try it one more times, more easy.

I want to get a recordset with the following fields in it:
adr_address.id, adr_address_kind.type, adr_address.name, adr_address.surename

How can I realize this?
Sorry, this are my first steps with ZF.

SQL Dump:

CREATE TABLE `adr_address` (
`id` int(10) unsigned NOT NULL auto_increment,
`adr_address_kind_id` int(10) unsigned NOT NULL,
`name` varchar(45) default NULL,
`surename` varchar(45) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

INSERT INTO `adr_address` VALUES (1, '1', 'Muffin', 'Ben');


CREATE TABLE `adr_address_kind` (
`id` int(10) unsigned NOT NULL auto_increment,
`typ` varchar(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

INSERT INTO `adr_address_kind` VALUES (1, 'Main Address');


Controller
ContactController.php
PHP Code:
class ContactController extends Zend_Controller_Action 
{
    function 
indexAction()
    {
        
$this->view->title "list of Addresses";
        
        
$contact = new Contact();
        
$this->view->contacts $contact->getContactList();        
        
$this->render();
        
    }  


Model
Contact.php
PHP Code:
class Contact extends Zend_Db_Table
{
    protected 
$_name 'adr_head';
    protected 
$_primary 'id';
    protected 
$_sequence true;
    
    public function 
getContactList ()
    {
        
// should give back:
        // adr_address.id, adr_address_kind.type, adr_address.name, adr_address.surename
        // and I don't know, how to make it :-((
              
        
return $this->fetchAll();
    }      

Thank you for Help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:29 AM.