开发者

a difficult query code

开发者 https://www.devze.com 2023-01-25 23:19 出处:网络
$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 (\';
  $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

精彩评论

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