我非常喜欢Drupal开发,MySQL,以及几乎所有的东西,所以这看起来似乎微不足道,但我真的很感激我能得到的任何帮助。 我收到了这个错误,而且我不确定是什么错,因为之前一切正常,而且自上次以来我没有改变它所提到的区域内的任何内容时间很完美。
确切的错误是:
PDOException:SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误;检查与您的MySQL服务器版本相对应的手册,以便在ASC'附近使用正确的语法。在第3行:SELECT n.nid AS nid FROM {node} n INNER JOIN {embryo_log} a ON n.nid = a.nid WHERE(n.type =:db_condition_placeholder_0)AND(a.expiration_date>:db_condition_placeholder_1_0)ORDER BY n.sticky DESC,n.changed DESC ASC;在embryo_log_all()中的数组([:db_condition_placeholder_0] => embryo_log [:db_condition_placeholder_1_0] => -1)(/data/www/drupal-7.34/sites/all/modules/embryo_log/embryo_log.module的第599行)。 "
以下是错误引用的整个功能,因为我不知道可能相关的内容:
function embryo_log_all($option = NULL, $action = NULL) {
$nodes_per_page = variable_get('embryo_log_per_page', variable_get('default_nodes_main', 10));
$output = '<div class="embryo_log">';
// If the optional param is numeric, assume it is a node or term id.
if (is_numeric($option)) {
if ($action == 'group') {
// Get all embryo_log with this term.
// TODO Change fully to a dynamic query
$result = db_query("SELECT n.nid FROM {node} n LEFT JOIN {taxonomy_index} tn USING (nid) WHERE n.type = :n.type AND n.status = :n.status AND tn.tid = :tn.tid", array(':n.type' => 'embryo_log', ':n.status' => 1, ':tn.tid' => $option));
foreach ($result as $nid) {
$embryo_log = node_load($nid->nid);
$output .= '<h2>' . check_plain($embryo_log->title) . '</h2>';
$build = node_view($embryo_log);
$output .= drupal_render($build);
}
return $output . '</div>';
}
else {
$embryo_log = node_load($option);
// If it is an embryo_log, ok, else ignore it.
if ($embryo_log != NULL) {
if ($embryo_log->type == 'embryo_log') {
$build = node_view($embryo_log, 'full');
// Plain node title
$outp = '<h2>' . check_plain($embryo_log->title) . '</h2>';
$build['#node']->title = ''; // Don't render title
return $outp . drupal_render($build);
}
}
}
}
if (user_access('edit embryo_log')) {
$args = array(-1);
}
else {
$args = array(gmdate("U"));
}
// $query = "SELECT n.nid FROM {node} n INNER JOIN {embryo_log} a ON n.nid=a.nid
// WHERE n.type='embryo_log' AND a.expiration_date > %d
// ORDER BY " . variable_get('embryo_log_page_order', 'n.sticky DESC, n.changed DESC');
$query = db_select('node', 'n');
$query->extend('PagerDefault')
->limit($nodes_per_page);
$query->innerJoin('embryo_log', 'a', 'n.nid = a.nid');
$query->condition('n.type', 'embryo_log', '=')
->condition('a.expiration_date', $args, '>')
->fields('n', array('nid'))
->orderBy(variable_get('embryo_log_page_order', 'n.sticky, n.changed'), '');
// $query_result = pager_query(db_rewrite_sql($query, 'n', 'nid'), $nodes_per_page, 0, NULL, $args);
$query_result = $query->execute();
foreach ($query_result as $nid) {
$embryo_log = node_load($nid->nid);
$build = node_view($embryo_log, $option);
$output .= drupal_render($build);
}
$output .= '</div>';
$output .= theme('pager', array('tags' => NULL));
return $output;
}
错误中专门引用的那一行(第599行)是底部的一行$query_result = $query->execute();
任何帮助都会非常感激,因为一切对我来说都很好,我也不知所措。
谢谢!