I have a PHP snippet that basically shows a list of recently updated stories. I have 7 shared sites, and I share the node table but the Epublish tables are not shared. For 6 of the sites the snippet works as it should. For the 7th site, I get a blank page. So I check the error log and see this:
PHP Fatal error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(n.nid), shared_node.changed, shared_node.title FROM shared_node, nw_epublish_ed' at line 1\nquery: SELECT shared_node.DISTINCT(n.nid), shared_node.changed, shared_node.title FROM shared_node, nw_epublish_edition_node WHERE ( shared_node.nid = nw_epublish_edition_node.nid ) AND ( shared_node.type = 'story' OR shared_node.type = 'flexinode-3' ) AND shared_node.status = 1 ORDER BY shared_node.changed DESC LIMIT 3 in /home/ooo/docs/includes/database.mysql.inc on line 66
My Snippet:
$result = db_query(db_rewrite_sql("SELECT shared_node.nid, changed, title FROM {node}, {epublish_edition_node} WHERE ({node}.nid = {epublish_edition_node}.nid) AND ( type = 'story' OR type = 'flexinode-3') AND status = 1 ORDER BY changed DESC LIMIT 3"));
The error message shows shared_node.DISTINCT(n.nid)
but the SQL script is just SELECT shared_node.nid,
Any ideas?