We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27302
    • 154 Posts
    After having to reinstall my websites after having been hacked, part of my site that uses a Ditto call now doesn’t work and keeps giving me the following error;

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - 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 ’pagetitle’ at line 4 »
    SQL: SELECT DISTINCT sc.id,sc.published FROM `fiveep_coolactivmain`.`modx_site_content` sc LEFT JOIN `fiveep_coolactivmain`.`modx_document_groups` dg on dg.document = sc.id WHERE sc.id IN (2,3,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,54,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,215,219,220,245,303) AND sc.published=1 AND sc.deleted=0 AND (sc.privateweb=0) GROUP BY sc.id ORDER BY sc.id pagetitle
    [Copy SQL to ClipBoard]

    My Ditto call is as follows
    [[Ditto?parents=`21`&depth=`2` &tpl=`DittoCats` &paginate=`1` &sortBy=`pagetitle` sortDir=`asc` &summarize=`6` &filter=`DittoSort,Land,7`]] 


    I find it really strange because all my other Ditto calls on the site, some of which use the same type of syntax, all work perfectly.

    The page in question is http://www.coolactiv.com/ from there click on either the Land, Air or Water icons, or the alphabet letters. Strangely some of the alphabet letters work. For example G.

    All of those Alphabet letters are created from the Ditto call. The page titles are A, B,C, D etc and ditto lists them as such. So I can’t understand why it isn’t working.
      • 27302
      • 154 Posts
      This is driving me mad now. All these Ditto calls were working perfectly before I changed to 9.6.3. Now two different pages with the same Ditto call, but with different parent id’s, behave differently. One gives me the pares error, the other one doesn’t!

      I really need to get this sorted out desperately.

      « MODx Parse Error »

      MODx encountered the following error while attempting to parse the requested resource:
      « Execution of a query to the database failed - 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 ’pagetitle’ at line 4 »
      SQL: SELECT DISTINCT sc.id,sc.published,sc.hidemenu FROM `fiveep_coolactivmain`.`modx_site_content` sc LEFT JOIN `fiveep_coolactivmain`.`modx_document_groups` dg on dg.document = sc.id WHERE sc.id IN (282,284,286,295,297,312,314,315,316,317,318,319,320) AND sc.published=1 AND sc.deleted=0 AND (sc.privateweb=0) GROUP BY sc.id ORDER BY sc.id pagetitle
        • 20413
        • 2,877 Posts
        Did you try clear modx cache?
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 27302
          • 154 Posts
          Yes, I tried a full cache clear.
            • 27302
            • 154 Posts
            Two seprate Ditto calls on two seperate pages.

            This one works just fine.
            [[Ditto?parents=`42`&depth=`1` &tpl=`DittoCats` &sortBy=`pagetitle` &sortDir=`asc` &paginate=`1` &summarize=`6` &filter=`hidemenu,0`]] 


            The other page with this call on it though doesn’t and throws up the sql parse error.
            [[Ditto?parents=`49`&depth=`1` &tpl=`DittoCats` &sortBy=`pagetitle` &sortDir=`asc` &paginate=`1` &summarize=`6` &filter=`hidemenu,0`]] 


            Utterly bizarre.

            Want to know what is really strange? If I change that second ditto call from parents=`49` to parents=`42` it works! So why on earth won’t the original ditto call for the page that requires parents=`42` work?

            Likewise if I change the page with the ditto call for parents=`42` to parents=`49` it throws up the parse error!
              • 27302
              • 154 Posts
              Okay, some progress. It seems to be related to another Ditto call at the top of the page
              [[Ditto?parents=`[*id*] &id=`11` &depth=`1` &tpl=`DittoFeatured` &total=`3` &orderBy=`myDate,desc`]]


              If there are no documents in the tree this call is trying to retrieve then the page loads fine. But if there are any documents it will throw up the parse error. This is strange because it was working perfectly under 9.6.1P2.

              It appears to be related to me using my own myDate TV.

              I have changed the Ditto call to
              [[Ditto?parents=`[*id*] &id=`11` &depth=`1` &tpl=`DittoFeatured` &total=`3` &sortBy=`myDate` &dateSource=`myDate`  sortDir=`desc`]]


              This has solved the problem on both the list by alphabetical letter pages and the land, air, water pages.
                • 20413
                • 2,877 Posts
                Try &orderBy=`myDate DESC` ...without ","
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower