SELECT statement in Zend_Framework

I have th following code that will display all the rows in a table.  I want to use a custom select statement to display data from more than one table.   How can I do this with zend_db_table ? Or do i need to use another class?

$this->view->title = "Showing All";
		$items = new Items();
		$this->view->items = $items->fetchAll();	
require_once 'Zend/Db/Table/Abstract.php';
class Items extends Zend_Db_Table_Abstract {
	 * The default table name 
	protected $_name = 't_items';
<p><a>Displaying Short View</a></p>
<?php foreach($this->items as $item) : ?>
     <td><?php echo $this->escape($item->nickname);?></td>
     <td><?php echo $this->escape($item->serial);?></td>
          <a href="<?php echo $this->url(array('controller'=>'index',
              'action'=>'edit', 'id'=>$item->id));?>">Edit</a>
          <a href="<?php echo $this->url(array('controller'=>'index',
              'action'=>'delete', 'id'=>$item->id));?>">Delete</a>
<?php endforeach; ?>

Open in new window

Who is Participating?
Alex-w474Connect With a Mentor Commented:
Look for Zend_Db_Select examples in manual:
Or use select object derived from the table:
$table = new Bugs();
$select = $table->select();
$select->where('bug_status = ?', 'NEW')
       ->join('accounts', 'accounts.account_name = bugs.reported_by')
       ->where('accounts.account_name = ?', 'Bob');
$rows = $table->fetchAll($select);

Open in new window

sean-keysAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.