Hi Guys,
I hope everyone had a very Merry Christmas and Happy New Year!
I’m having a problem where one of my query tags that’s in a snippet which works perfect in my standard template pages but throws the following error when I try to load it in my wiki pages:
Error Number: 1064
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 'current_time format='%Y'} and month(FROM_UNIXTIME(cd.field_id_8)) = {current_t' at line 1
SELECT cd.channel_id,ct.title,cd.field_id_8 as dt,cd.field_id_9 as rate FROM exp_channels c, exp_channel_data cd, exp_channel_titles ct where c.channel_name = 'exchange_rates' and cd.channel_id = c.channel_id and ct.channel_id = cd.channel_id and ct.entry_id = cd.entry_id and ct.status = 'open' and year(FROM_UNIXTIME(cd.field_id_8)) = {current_time format='%Y'} and month(FROM_UNIXTIME(cd.field_id_8)) = {current_time format='%m'}
Filename: modules/query/mod.query.php
Line Number: 181Here is the full code in my snippet:
<div id="divExchangeRateContainer">
<div id="divExchangeRateSymbolContainer">
<div id="divExchangeRateSymbol">$</div>
</div>
<div id="divExchangeRate">
{exp:query limit="1" sql="SELECT cd.channel_id,ct.title,cd.field_id_8 as dt,cd.field_id_9 as rate
FROM exp_channels c, exp_channel_data cd, exp_channel_titles ct
where c.channel_name = 'exchange_rates'
and cd.channel_id = c.channel_id
and ct.channel_id = cd.channel_id
and ct.entry_id = cd.entry_id
and ct.status = 'open'
and year(FROM_UNIXTIME(cd.field_id_8)) = {current_time format='%Y'}
and month(FROM_UNIXTIME(cd.field_id_8)) = {current_time format='%m'}"}
<a href="/exchange-rates/{dt">{dt format="%M %Y"} US Rate_$1.00USD = ${rate}CAD</a>
{/exp:query}
</div>
</div>Am I doing something wrong or is this a bug? Any help is appreciated.
Thank you,
Mike