I get a MySQL error when trying to load the categories page on the cvs version (but I think the error applies to previous versions also).

Looking through the code I notice the following lines:

$type_q = ($type ? " AND n.type = '$type'" : "");
$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.type, u.uid, u.name FROM {term_node} r LEFT JOIN {node} n ON r.nid = n.nid LEFT JOIN {users} u ON n.uid = u.uid WHERE $type_q AND r.tid = '$term->tid' ORDER BY n.changed DESC"), 0, variable_get("taxonomy_dhtml_overview_count", 50));

Whatever the $type_q variable is set to the MySQL statement will always have an "AND" directly after the "WHERE". This will always cause an error, no? Maybe the MySQL version I have is less forgiving.

Anyway changing the second line to:

$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.type, u.uid, u.name FROM {term_node} r LEFT JOIN {node} n ON r.nid = n.nid LEFT JOIN {users} u ON n.uid = u.uid WHERE r.tid = '$term->tid' $type_q ORDER BY n.changed DESC"), 0, variable_get("taxonomy_dhtml_overview_count", 50));

works and I think follows the intended idea.

Comments

moshe weitzman’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)