Hey, I'm trying to hack arund with taxonomy block to get, for example, better support of nodes with many terms. But I'm running into odd behaviour with db_fetch_object.

to whit:

$nodescount = db_query('SELECT count(DISTINCT(n.nid)) FROM {node} n CROSS JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (%s) AND n.status = 1', implode($str_tids, ','));
$nodecount = db_fetch_object($nodescount);

returns '3', but

$str_tids=array('41');
$content='<ul>';
$nodesquery = db_query('SELECT DISTINCT(n.nid), n.title, n.body, tn.tid FROM {node} n CROSS JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (%s) AND n.status = 1 ORDER BY sticky DESC, created DESC LIMIT %d', implode($str_tids, ','), $result->length);
while ($node = db_fetch_object($nodes)) {
  $content .= '<li>.l($node->title, 'node/'.$node->nid).'<li>;
}
 

returns an empty string. (Drupal 4.5.2/Civicspace 0.8.3))

Running the same queries manually (minus the curly braces) using the mysql client produces a list of 3 results.
I have squinted at this until my eyeballs twitched, but can't imagine what's wrong. and if i try to put some print_r statements inside the db_fetch_object the page becomes a mess of debugging strings.

Does anyone have hints about how to tackle this one?

Comments

moshe weitzman’s picture