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.

Gallery category giving me Error!!!

July 15, 2008 1:29am

Subscribe [1]
  • #1 / Jul 15, 2008 1:29am

    bonusballking

    17 posts

    Hi

    I went to my gallery to view some more uploaded pics.

    And i get this error.

    I did make changes in the categories, Like change the category name and also the folder name it is in… and i think thats when it started happening.

    Here is the site link.

    www.amsterdam-sabotage.com

    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 'title, e.entry_id title' at line 5
    
    Query: SELECT e.entry_id FROM exp_gallery_entries AS e LEFT JOIN exp_galleries AS p ON p.gallery_id = e.gallery_id LEFT JOIN exp_gallery_categories AS c ON c.cat_id = e.cat_id LEFT JOIN exp_members AS m ON e.author_id = m.member_id WHERE e.gallery_id = '1' AND e.status = 'o' AND e.entry_date < 1216088693 AND e.cat_id = '3' ORDER BY e.entry_date title, e.entry_id title

    Thank you.

  • #2 / Jul 15, 2008 10:03am

    Robin Sowell

    13255 posts

    What build and version are you running?  I couldn’t spot that exact query in the current code.  And what’s the url look like on the page that generates the error?  (Change the system name when you post- I just need the bits after index.php.)

  • #3 / Jul 15, 2008 10:57am

    bonusballking

    17 posts

  • #4 / Jul 15, 2008 11:06am

    Robin Sowell

    13255 posts

    Odd- I still can’t find it in the code- though I am looking at the latest build of 1.6.4.  Can’t spot it in 1.6.3 either.  Let’s see- it only shows the error when you have a category indicator in the url?  And this is only on the frontend- correct?  Can you paste the contents of your gallery/category template?  Want to see if that gives me a hint.

  • #5 / Jul 15, 2008 11:15am

    bonusballking

    17 posts

    WOW, what i just noticed that i went into the gallery template and everything is gone, the template group is there but no templates, i have no idea why thats not there….

    In which folder can look for the template on the server, see if maybe they are there…
    Or get the default once back.

    Thank you.

  • #6 / Jul 15, 2008 11:20am

    bonusballking

    17 posts

    Wait a minute now it came back, this is so messed up… I have no idea why it’s doing it.

    Here is the code.

    <div id="content">
    
     {exp:gallery:entries gallery="main_photo_gallery" orderby="date" sort="title"columns="4" rows="10"}
    
    <div id="header_gallery">
    
    <h1>{category}</h1>
    
    <div id="select_category">
    <form>
    <select class="select_box" name="URL">
    <option value=" ">Select Category</option>
    
    {exp:gallery:category_list gallery="main_photo_gallery"}
    <option value="{category_path=gallery/category} ">{category_name}</option>
    {/exp:gallery:category_list}
    
    </select>
    </form>
    </div>
    
    </div>
    
    <div id="breadcrumb">
    <a href="http://{path=">Gallery</a>{exp:gallery_breadcrumbs} > <a href="http://{category_path=">{category_name}</a>{/exp:gallery_breadcrumbs}
    </div>
    
    <table class="photo_table" cellpadding="0" cellspacing="6">
    
    {entries}
    
    {row_start}<tr>{/row_start}
    
    {row}
    <td class="photo_cell">
    <a href="http://{medium_url}">"]{thumb_url}</a>
    
    </td>
    {/row}
    
    {row_blank}<td> </td>{/row_blank}
    
    {row_end}</tr>{/row_end}
    
    {/entries}
    
    </table>
    
    
    {paginate}
    <div class="paginate_gallery">
    page {current_page} of {total_pages} pages {pagination_links}
    </div>
    {/paginate}
    
    
    {/exp:gallery:entries}
    
    
    </div>
  • #7 / Jul 15, 2008 11:29am

    Robin Sowell

    13255 posts

    Is that the full template?  If so- you have an open gallery entries tag- and the list is nested inside it.  See what I mean?  Still don’t know why the query is coming out like it is- but I’d expect that to goof things up a bit.  Is the gallery entries tag doing anything?  If not- take it out.  Otherwise- close the tag before the list.

  • #8 / Jul 15, 2008 11:33am

    bonusballking

    17 posts

    I’ve update the code above…!!

    Sorry for the bad posting.

  • #9 / Jul 15, 2008 12:00pm

    Robin Sowell

    13255 posts

    AHHHHH!  Man- that took me a while.  OK- problem is with your sort:

    {exp:gallery:entries gallery="gallery" orderby="date" sort="title" columns="4" rows="10"}

    The sort parameter only has two valid values- asc and desc- for ascending/descending.

    You’re telling it to sort by title.  And the code needs a tweak to make sure you can’t inadvertantly cause a mysql error- like you just did:

    $sort  = $TMPL->fetch_param('sort');
                    
            if ($sort == FALSE AND $sort != 'asc' AND $sort != 'desc')
            {
                $sort = 'desc';
            }

    Not sure why it’s checking for FALSE.

    Anyway- I’ll put in a bug report because it really shouldn’t let you trigger an error so easily.  But basically- change the sort to asc/desc and it should be fine.

    Make sense?

  • #10 / Jul 15, 2008 12:04pm

    bonusballking

    17 posts

    Sorry if i sound dumb, but where do i go to change that asc/dec thing.
    I’m not got with PHP.

    Thank you.

  • #11 / Jul 15, 2008 12:06pm

    Robin Sowell

    13255 posts

    Ah- sorry.  It’s in your template- your entries tag:

    sort="title" 
    just remove it or replace it with
    sort="desc"

    And- I still wouldn’t nest those other tags inside your entries tags- could have unintended consequences.  But the error is due to that sort parameter.

  • #12 / Jul 15, 2008 12:10pm

    bonusballking

    17 posts

    It works, thank you very very much… you are a life saver…

    This is what i like the best from EE… THE SUPPORT

    Thank you. Again

  • #13 / Jul 15, 2008 12:28pm

    Robin Sowell

    13255 posts

    😉  Was an interesting problem, so I enjoyed poking it.  Glad you’re squared away- and closing this one out.

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

ExpressionEngine News!

#eecms, #events, #releases