a difficult query code
$query = 'S开发者_如何转开发ELECT DISTINCT(t.nid), n.nid, n.title FROM {node} n INNER JOIN {term_node} t ON n.nid = t.nid WHERE n.nid != %d AND (';
// except the current node
$args = array($node->nid);
$tids = array();
foreach ($node->taxonomy as $term) {
$tids[] = 't.tid = %d';
$args[] = $term->tid;
}
$query .= implode(' OR ', $tids) . ')';
the query code is written by a guru. but i don't understand the rest AND (';...part.hope someone can explain it for me. thank you.
Look at the finished generated query (echo $query;
) and it will become clearer.
精彩评论