views:

9

answers:

0

Why does the following query work within a Drupal Block, but not when part of a "custom content" in a pane within a Panels Page? It gives an error saying to check the syntax of the query near "AND node.type in....". Also, if I put it in a Block then display that Block inside a Panels Page, it works just fine. So while I've got this working... I really want to know why it wouldn't work when placed directly in the Panel content.

<?php
global $user;
if($user->uid) {
$result = db_query("Select COUNT(node.nid) from {node}
   LEFT JOIN {flag_content} flag_content_node 
       ON node.nid = flag_content_node.content_id AND 
       flag_content_node.fid = 7 
       where node.uid = %d AND node.type in ('node_type') AND
       (flag_content_node.uid IS NULL)", $user->uid);

$item_count = db_result($result);

print $item_count;
}?>