-2

Drupal-6 日志条目中收到错误

您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 14 行查询附近的 ')' 附近使用正确的语法:SELECT node.nid AS nid, node.title AS node_title, node.uid AS node_uid, node.type AS node_type, node_revisions.format AS node_revisions_format, node_data_field_link_of_deal.field_link_of_deal_url AS node_data_field_link_of_deal_field_link_of_deal_url, node_data_field_link_of_deal.field_link_of_deal_title AS node_data_field_link_of_deal_field_link_of_deal_title, node_data_field_link_of_deal.field_link_of_deal_attributes AS node_data_field_link_of_deal_field_link_of_deal_attributes, node.vid AS node_vid FROM node node INNER JOIN term_node term_node ON node.vid = term_node.vid LEFT JOIN node_revisions node_revisions ON node .vid = node_revisions。

我在 tag_cloud.php 中的代码

<?php
$city_id = $_COOKIE['city_id'];
$sql="  SELECT node.nid AS nid,
node.title AS node_title,
node.uid AS node_uid,
node.type AS node_type,
node_revisions.format AS node_revisions_format,
node_data_field_link_of_deal.field_link_of_deal_url AS        
node_data_field_link_of_deal_field_link_of_deal_url,
node_data_field_link_of_deal.field_link_of_deal_title AS      
node_data_field_link_of_deal_field_link_of_deal_title,
node_data_field_link_of_deal.field_link_of_deal_attributes AS     
node_data_field_link_of_deal_field_link_of_deal_attributes,
node.vid AS node_vid
FROM node node 
INNER JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
LEFT JOIN content_type_popular_deal node_data_field_link_of_deal ON node.vid =     node_data_field_link_of_deal.vid
WHERE (node.type in ('popular_deal')) AND (term_node.tid = $city_id)
";

$result = db_query($sql);

?>
4

1 回答 1

0

您的变量$city_id为 null 或空字符串

... (term_node.tid = $city_id) ...

在错误消息上变成这样:

... (term_node.tid = ) ...

这使它成为一个 sql 语法错误。你应该把它改成这样:

... (term_node.tid = '{$city_id}') ...
于 2013-08-20T16:59:31.220 回答