|
|||
|
Hello.
I have the following problem: I want to use Zend_Db_Table_Select to join two tables, but I always get this error message: Code:
Warning: Select query cannot join with another table in /home/.../Zend/Db/Table/Select.php on line 191
Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty' in /home/.../Zend/Db/Statement/Pdo.php:238
Stack trace: #0 /home/.../Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/.../Zend/Db/Adapter/Abstract.php(406): Zend_Db_Statement->execute(Array)
#2 /home/.../Zend/Db/Adapter/Pdo/Abstract.php(206): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array)
#3 /home/.../Zend/Db/Table/Abstract.php(1184): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select))
#4 /home/.../Zend/Db/Table/Abstract.php(1039): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select))
#5 /var/www/.../test/test.php(26): Zend_Db_Table_Abstract->fetchAll(Object(Zend_Db_Table_Select))
#6 {main} thrown in /home/.../Zend/Db/Statement/Pdo.php on line 238
PHP Code:
members: id,group_id,[...] groups: id,name Members.php: PHP Code:
PHP Code:
I hope someone can help me. Cheers, Florian |
|
|||
|
hi, i was told you need to set setIntegrityCheck to false
i also found an article about improvements in zend_db_table: Zend Framework in Action Zend_Db_Table_Abstract in version 1.5 |
|
|||
|
Hi, I've been trying a similar thing, with setIntegrityCheck(false).
I have two tables, Prizes and Products (Prizes being a type of product, and they share the same primary key), which need to be joined together. I've been trying something like this: $select->setIntegrityCheck(false)->joinNatural('Products')...... where $select is a zend_db_table_select from the zend_db_table for prizes and I get a result that looks like this: SELECT `Products`.* FROM `Products` when I echo out the select. Why is this happening? |
|
||||
|
__________________
- xentek |
|
|||
|
I defined my relationships, I'll double check that I did it correctly (in this case Products is a dependent table for Prizes?). If this is done correctly, would that enable me to join, without disabling the reference check?
|
|
|||
|
I think I'm having the same problem as the OP. I have 2 tables with correctly defined relationships, message and user. I want to get all messages (as a RowSet) for all users who meet certain criteria. Sort of like:
SELECT m.* FROM messages m JOIN users u on u.id = m.user_id WHERE u.name LIKE 'fred%' At the moment, I'm doing (inside the Message class, ignoring quoting): PHP Code:
|
|
|||
|
And, I've just found a solution
![]() Adapted from a Nabble forum thread (second-to-last post): PHP Code:
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|