开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜