[support] What's wrong with this query?

Jamie Holly hovercrafter at earthlink.net
Fri Jul 6 20:48:55 UTC 2012


$result doesn't contain the actual results, but rather the select class. 
Do something like:

$data = $result->execute();

Then data will contain the actual query results object;

Jamie Holly
http://www.intoxination.net
http://www.hollyit.net

On 7/6/2012 4:43 PM, Ms. Nancy Wichmann wrote:
>   $result = db_select('taxonomy_term_data', 't');
> $result->addField('t', 'tid');
> $result->condition('t.vid', $vids, 'IN')
> ->condition(db_or()->condition('t.description', "%$keys%", 
> 'LIKE')->condition('t.name', "%$keys%", 'LIKE'))
>     ;
> $result->execute();
>
>   $found = NULL;
>   foreach ($result as $row) {
>     $output .= print_r($row, true);
>   }
> The Devel query log shows the query properly built. I copied the query 
> from the log into PhpMyAdmin and it gets one row. But my code shows 
> nothing fetched.
> /*Nancy*/
>
>
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120706/eeb2f573/attachment-0001.html 


More information about the support mailing list