set integrity check flag to false, it should be enought
I'm trying to use Zend_Paginator to paginate my members table with the DbSelect adapter. In order to use it, you have to provide a Zend_Db_Select object. I am trying to do this, but I need to do a query like this:
How would I do something like this, but inside of the select() statement. How would I do it?Code:SELECT members.* FROM members, members_classifications WHERE members_classifications.mem_id = members.id AND members_classifications.class_id = 123
I tried this:
[php] $select->join(array('mc' => 'members_classifications'), 'mc.mem_id = members.id');
$select->where('mc.class_id = ?', $params['class']);[/php]
But it gave me this exception:
Code:Exception type: Zend_Db_Table_Select_Exception Message: Select query cannot join with another table
Last edited by nozavroni; 08-13-2008 at 06:27 PM.
set integrity check flag to false, it should be enought
i have a same problem with Zend_Db_Select..
i use Zend_Db_Table, the name is EnginePosts and i try to join the table like this..
$this->table = new EnginePosts();
$select = $this->table->select()->setIntegrityCheck(false);
$select->joinLeft("engine_term_relation","term_rel_id_ob j = post_id");
$resultset = $this->table->fetchAll($select);
and i get this message:
Uncaught exception 'Zend_Db_Table_Row_Exception' with message 'Specified column "post_date" is not in the row'........
Last edited by pashazend; 08-15-2008 at 06:11 AM.
you should specify table name in row definition, I guess. What table structure you have?
this is my table structure :
`post_id` int(11) NOT NULL,
`post_title` text,
`post_content` text,
`post_date` datetime default NULL,
`post_status` varchar(20) default NULL,
`post_guid` varchar(200) default NULL,
`post_type` varchar(10) default NULL
and i write this code :
class EnginePosts extends Zend_Db_Table
{
protected $_name = 'engine_post';
}
in EnginePosts.php
maybe you can do it like this:
[PHP]
$select->from($this->members,"*");
$select->join($this->members_classifications,$this->memebers_classifications.'.id='.$this->members.'.id','*');
$select->where("$this->members_classifications.class_id=?","123");
[/PHP]
it's just my opinion.