After hours of testing different options I cannot find how to simply make a PHP code argument work in D7:
$result = db_query('SELECT entity_id FROM dr_field_data_field_departement WHERE field_departement_tid=4');
return $result;
this one returns: Object of class DatabaseStatementBase could not be converted to string in DatabaseStatementBase->execute() (line 2039
$result = db_query('SELECT entity_id FROM dr_field_data_field_departement WHERE field_departement_tid="4"');
return $result;
this one gets: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column '4' in 'where clause': SELECT entity_id FROM dr_field_data_field_departement WHERE field_departement_tid="4"; Array
(
)
in eval() (line 1
An idea?
Comments
Comment #1
dawehnerYour php code is a major bug, this is obvious :)
What about this:
For more informations about the dbtng syntax have a look at http://drupal.org/node/310072
Comment #2
zanoman commentedman, thanks!
it looks weird to me but works perfectly, brilliant!
I'm the bug in this story :)
Have a very nice day
Comment #3
zanoman commentedhow to get more than one result?
Comment #4
zanoman commentedfetchAll throws:
Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2039
Comment #5
zanoman commentedComment #6
dawehnerPlease be fair. There are thousand of other places to get help for dbtng:
* the forum
* IRC
* ...
* payed support etc.
Please read http://drupal.org/node/310072
Comment #7
zanoman commentedOk, thanks again Dereine.
It's very kind of you for pointing me to this valuable post.
Cheers