mam dwie tabele:
articles:
i_id,
i_name,
i_text
druga tabela:
users
id,
username,
password,
first_name,
last_name,
role
Robięto w ten sposób:
Model:
<?php class Model_Select extends Zend_Db_Table_Abstract { protected $_name = 'articles'; protected $_primary = 'i_id'; { $select = $this->select() 'a.i_id = u.id', return $this->fetchAll($select); } }
kotroler
public function joinAction() { // action body $modelselect = new Model_Select(); //$modelselect->setIntegrityCheck(false); $this->view->select = $modelselect->join(); }
widok
Kod
<?php foreach($this->select as $row): ?>
<table class="table1">
<tr><td colspan="2" class="title"><strong class="red">ID:</strong><?php echo $row->i_id ?></td></tr>
<tr><td><strong class="blue">Tytuł:</strong></td><td><?php echo $row->i_name ?></td></tr>
</table>
<?php endforeach ?>
<table class="table1">
<tr><td colspan="2" class="title"><strong class="red">ID:</strong><?php echo $row->i_id ?></td></tr>
<tr><td><strong class="blue">Tytuł:</strong></td><td><?php echo $row->i_name ?></td></tr>
</table>
<?php endforeach ?>
Dostaję taki komunikat błędu:
Kod
Exception information:
Message: Select query cannot join with another table
Message: Select query cannot join with another table