We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8425
    • 159 Posts
    Hello,
    I’m getting a MODx parse error from time to time when I try to access a private document when a web user is not logged in.
    This is what I get:
     
    « 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 '' at line 1 »
          SQL: SELECT comment FROM `modx_virtualahub`.`modx_web_user_attributes` WHERE `internalKey`= 
    


    How can I go about debugging this? I looked at the event log but it doesn’t give me any other info.
    Thanks for any pointers.
      • 5340
      • 1,624 Posts
      First of all, that error is for a table that does not exist in the default installation for modx.

      So you need to find what module/plugin/snippet is requesting that information.

      Most likely the ’internalKey’ is not defined or correct or does not exist.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I’m sorry to be contradictory, but the table does in fact exist in a default MODx installation. It’s where the user data is stored for email, full name, etc.

        I would suspect a MySQL setting to be the culprit; something to do with strict_mode perhaps. The field internalKey is created as NOT NULL, while the snippet is sending a null value. I think. I’m not exactly an SQL expert, however.

        What version of MODx, PHP and MySQL are you using?
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 5340
          • 1,624 Posts
          Sorry

          I thought modx_virtualahub was the table. I don’t name my DBs with modx as a prefix.
          Please ignore my post
            • 8425
            • 159 Posts
            Thanks for your replies. Yes the table does in fact exist in a default MODx. I’m using MODx 9.6.3 and PHP Version 5.2.5.
            The field "internalKey" is of type INT and NotNull...
            Thanks again for your help...
              • 8425
              • 159 Posts
              Do I need to turn off strict_mode? I’m not sure of the implications. Please advise.

              Note: I think I can turn off strict mode with this command: SET @ @global.sql_mode = ’’