I am getting the following error on a template where I use the custom fields extension, and I am wondering if it may be what’s causing the error:
MySQL ERROR:
Error Number: 1064
Description: 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 'WHERE t.entry_id !='' AND t.entry_date < 1177334641 AND (t.expiration_date = 0' at line 2
Query: SELECT t.entry_id FROM exp_weblog_titles AS t LEFT JOIN exp_weblogs ON t.weblog_id = exp_weblogs.weblog_id LEFT JOIN exp_weblog_data AS wd ON t.entry_id = wd.entry_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id INNER JOIN exp_weblog_data AS d ON t.entry_id=d.entry_id AND WHERE t.entry_id !='' AND t.entry_date < 1177334641 AND (t.expiration_date = 0 || t.expiration_date > 1177334641) AND exp_weblogs.is_user_blog = 'n' AND t.weblog_id = '32' AND t.status = 'open' ORDER BY t.sticky desc, wd.field_id_144 asc LIMIT 0, 1
{exp:weblog:entries weblog="{current_weblog}" limit="1" orderby="{current_weblog_id}_number_sorting" sort="asc" dynamic="off" 32_number_display="{segment_3}"}{weblog} - {{current_weblog_id}_number_display} {title}{/exp:weblog:entries}
‘32_number_display’ is the custom field. This template is setup to be accessed with segments added, and the error occurs only when no segment at all is added, so it probably relates to that. But I am not sure how to work around that.
Hi there, The extension sounds great but I don’t have the code you mention in the top of the actual extension file in my mod.weblog.php
The second bit should be this according to the note in the extension file:
$sql = "SELECT * FROM exp_relationships
WHERE rel_child_id IN ('".implode("','",
array_keys($this->reverse_related_entries))."')
AND rel_type = 'blog'";
Closest to that is this:
$sql = "SELECT * FROM exp_relationships WHERE rel_id IN (";
$templates = array();
foreach ($this->related_entries as $val)
{
$x = explode('_', $val);
$sql .= "'".$x['0']."',";
$templates[] = array($x['0'], $x['1'], $TMPL->related_data[$x['1']]);
}
$sql = substr($sql, 0, -1).')';
$query = $DB->query($sql);
it goes on….
Why is this? Does this extension work in all versions of Expression Engine above 1.4?
Thanks for reminding me, I had put the hooks back in but not tested it. It is working fine for me. Mark would it be helpful if I posted a new set of intructions about where to insert things when I get back to work on Monday? It looked like they changed the query for reverse related entries, so there may be some optimization to be done, but for what I’m using it for anyway it still works beautifully.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.