ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Channel Module throwing a MySQL syntax error

February 22, 2012 4:23pm

Subscribe [2]
  • #1 / Feb 22, 2012 4:23pm

    imageworks

    14 posts

    I’m using EE 2.4.0, Structure3.1.3 and the most up-to-date version of freebie.

    On some pages I’m getting thrown this error. Anyone know what it means and how it might be able to be fixed? Or should I just report this as a bug in the bug tracker?

    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 ‘AND t.entry_date <= AND t.status = ‘open’ ORDER BY t.entry_date desc, t.entry_i’ at line 2

    SELECT t.entry_id FROM exp_channel_titles AS t LEFT JOIN exp_channels ON t.channel_id = exp_channels.channel_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id WHERE t.entry_id !=’’ AND t.site_id IN (‘1’) AND t.entry_date < 1329945459 AND (t.expiration_date = 0 OR t.expiration_date > 1329945459) AND (t.channel_id = ‘2’ OR t.channel_id = ‘9’ OR t.channel_id = ‘10’ OR t.channel_id = ‘11’ OR t.channel_id = ‘12’ ) AND t.entry_date >= AND t.entry_date <= AND t.status = ‘open’ ORDER BY t.entry_date desc, t.entry_id desc LIMIT 0, 50

    Filename: modules/channel/mod.channel.php

    Line Number: 2686

  • #2 / Feb 23, 2012 4:41pm

    Shane Eckert

    7174 posts

    Hello imageworks,

    I am sorry to hear you are running into this problem.

    Can you include the contents of the template that is displaying this error? That will help me troubleshoot this error.

    I am looking forward to your response!

    Cheers,

  • #3 / Feb 23, 2012 5:12pm

    imageworks

    14 posts

    Here is the code

    <ul class="main_news">
    {exp:channel:entries channel="{segment_1}_news" dynamic="off" limit="50" orderby="date" sort="desc" sticky="no" disable="member_data|categories|trackbacks" year="{freebie_3}" month="{freebie_4}"}
    {date_heading display="monthly"}
                     
    <h2>Posts from {entry_date format="%F %Y"}</h2>
    <p>                 <br />
    {/date_heading}<br />
     <li><a href="http://{page_url}">_        <span class="title">{exp:power_truncate length="50" cut_words="t" suffix="..."}{title}{/exp:power_truncate}</span>__        <span class="date">Posted {entry_date format="%n-%d-%Y"} | </span>_        <span class="excerpt">{exp:excerpt limit="30" indicator="..."}{body_content}{/exp:excerpt}</span>_        <span class="location">{exp:power_truncate length="75" cut_words="t" suffix="..."}{page_uri}{/exp:power_truncate}</span>_     </a><br />
     </li></p>
    
    
    
    <p>{/exp:channel:entries}<br />
    </ul>

    It works fine if the URL is

    site.com/section/news

    But if I add the year and month to filter results, like so

    site.com/section/news/2012/02

    It breaks.

    Hopefully you see something I’m missing that will help.

  • #4 / Feb 24, 2012 5:21pm

    Shane Eckert

    7174 posts

    Hello Imagworks,

    It looks like either structure or freebie is not playing nice. I am leaning towards freebie because of how freebie can “Ignore numeric segments”.

    Can you contact the Freebie developer (Doug Avery) and check with him? I am wondering if Freebie is compatible with 2.4.

    Let me know what you find or if I can do anything else to help.

    Cheers,

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases