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.

SQL Errors on Comment Entries tag after upgrade to 2.1.1

October 18, 2010 10:38pm

Subscribe [3]
  • #1 / Oct 18, 2010 10:38pm

    fostermade

    97 posts

    Hello,

    I upgraded a dev site to 2.1.1 this evening from 2.1.0 and am receiving the following error from the comment entries tag: {exp:comment:entries sort="asc" limit="20"}

    Error
    
    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 entry_id = ‘11’
    AND `exp_channel_titles`.`channel_id` = exp_channels.channel’ at line 3
    
    SELECT `entry_id`, `exp_channel_titles`.`channel_id`
    FROM (`exp_channel_titles`, `exp_channels`)
    WHERE AND entry_id = ‘11’
    AND `exp_channel_titles`.`channel_id` = exp_channels.channel_id
    AND `exp_channel_titles`.`site_id` IN (‘1’)
    AND (`expiration_date` = 0 OR `expiration_date` > 1287451501)
    AND `status` != ‘closed’
    AND `exp_channel_titles`.`channel_id` = ‘2’
    
    Filename: modules/comment/mod.comment.php
    
    Line Number: 282


    The template generating the error has the following comment entries tag:

    {exp:comment:entries sort="desc" entry_id="{embed:entry_id}" channel="projects" dynamic="no"}


    The error only occurs if I pass the entry_id or url_title params.  It appears the following code causes the error:

    // Check if an entry_id or url_title was specified
                if ($entry_id = $this->EE->TMPL->fetch_param('entry_id'))
                {
                    //$this->EE->db->where('entry_id', $entry_id);
                    $sql = $this->EE->functions->sql_andor_string($entry_id, 'entry_id');
                    $this->EE->db->where($sql, NULL, FALSE);
                }
                elseif ($url_title = $this->EE->TMPL->fetch_param('url_title'))
                {
                    //$this->EE->db->where('url_title', $url_title);
                    
                    $sql = $this->EE->functions->sql_andor_string($url_title, 'url_title');
                    $this->EE->db->where($sql, NULL, FALSE);
                    
                }

    Thoughts?

    Thanks,
    Shawn

  • #2 / Oct 19, 2010 12:09am

    fostermade

    97 posts

    To ensure this was not a result of any of the custom add-ons on the dev site I installed a fresh copy of 2.1.1 on a new subdomain.  Using the default agile records templates I can generate the same error by editing the news/comments template as follows.

    {exp:comment:entries sort="asc" limit="20" channel="news" entry_id="2"}
  • #3 / Oct 19, 2010 8:21am

    Sue Crocker

    26054 posts

    Shawn, so you’re not relying on the url to get the entry_id? What does your url look like?

  • #4 / Oct 19, 2010 9:09am

    fostermade

    97 posts

    Hi Sue,

    I am not relying on the url to get the entry id.  I can allow the url to dictate the entry in this case but I’m specifically testing the entry_id parameter.

    Here is the url to the agile records site.
    http://ee21.eecoder.com/index.php/news/comments/welcome_to_the_example_site

    -Shawn

  • #5 / Oct 19, 2010 9:51am

    Sue Crocker

    26054 posts

  • #6 / Oct 19, 2010 9:57am

    fostermade

    97 posts

    Great.  Thanks Sue.

  • #7 / Oct 19, 2010 11:38am

    Sue Crocker

    26054 posts

    Robin has posted a quick fix for this. Give it a try and see if that helps.

  • #8 / Oct 19, 2010 11:52am

    fostermade

    97 posts

    Thanks Sue.  It does.  I’m all set.

  • #9 / Oct 19, 2010 2:57pm

    Ingmar

    29245 posts

    Excellent 😊 Please post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases