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.

How to include } in query

May 13, 2011 4:51pm

Subscribe [2]
  • #1 / May 13, 2011 4:51pm

    blendimc

    150 posts

    I’m trying to run the following query (complex b/c I’m trying to parse out the FileDir from the file field. However, its not getting run because there is an } in the query and this is causing the query to stop running. Any Suggestions?

    {exp:query sql="select 
        t1.title as title, 
        concat(url,substring(d.field_id_44,LOCATE('}',d.field_id_44)+1)) as img,
        t1.url_title as url_title,count(parent_entry_id) as count from exp_channel_titles as t1
        join exp_playa_relationships as r on t1.entry_id = r.child_entry_id 
        join exp_channel_data as d on d.entry_id = t1.entry_id 
        join exp_upload_prefs as p on (select substring(d.field_id_44,10,LOCATE('}',field_id_44)-10)) = p.id 
        where t1.channel_id = 8
        group by t1.title
        order by count desc
        limit 5"}
  • #2 / May 13, 2011 5:08pm

    blendimc

    150 posts

    I ended up replacing } with CHAR(125), but I am curious if there is another way to do this?

  • #3 / May 13, 2011 6:34pm

    Brandon Jones

    5500 posts

    blendimc,

    Make sure your debug preference is set to 1, otherwise you might see this behavior due to the way the template parser works.

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

ExpressionEngine News!

#eecms, #events, #releases