We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10156
    • 9 Posts
    Hi,
    I’m using Maxigallery to display a random image on my homepage (my call is :
    [!MaxiGallery? &gal_query_ids=`all` &order_by=`random` &limit=`1`!])
    and I’ve got the following MySQL problem (others home-made snippets are present on my homepage
    and use the same database):

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »

    PHP error debug
    Error: mysql_query(): Can’t connect to local MySQL server through socket ’/var/lib/mysql/mysql.sock’ (2)
    Error type/ Nr.: Warning - 2
    File: /hsphere/local/home/french/srfc.frenchwill.fr/assets/snippets/maxigallery/maxigallery.php
    Line: 241
    Line 241 source: $query=mysql_query("DESC $mg->pics_tbl");


    Any idea of what I can do to solve it ?
      • 7923
      • 4,213 Posts
      So other snippets are querying the database fine, but not maxigallery?

      also see this...


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 10156
        • 9 Posts
        The problem is that MaxiGallery works fine on a page with no other snippets, but cause this error
        when called on the homepage. I don’t understand.
          • 7923
          • 4,213 Posts
          Do you have some snippets on the page that use another database by any chance?

          This can cause some problems.. see: http://wiki.modxcms.com/index.php/Access_another_database_from_MODx


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 10156
            • 9 Posts
            No, all the tables (maxigallery, modx and others) are in the same database.
              • 7923
              • 4,213 Posts
              Hmm.. I don’t have a clue what’s causing it then.

              What other snippets you have running on the same page? Have you tried to pinpoint what causes these errors by disabling all other snippets and enabling them one by one..


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 10156
                • 9 Posts
                The site is http://srfc.frenchwill.fr
                The problem is in the right side bar, when I add the call :
                [!MaxiGallery? &gal_query_ids=`16` &query_level_limit=`5` &order_by=`random` &limit=`1`!]
                There are 2 homemade snippets to query the database and display the next matchs (Prochains Matchs)
                and championship table (Classement).

                The only way to make the MaxiGallery call work is to remove the call to my 2 others snippets
                  • 7923
                  • 4,213 Posts
                  Well.. to me it seems that after your snippets are run, the database cannot be queried through MODx api. So.. I guess there’s something wrong in your snippets and specifically the way you access database. But these are just guesses.


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 10156
                    • 9 Posts
                    Yes, thanks a lot, your guesses were right !
                    The problem was the use of mysql functions instead of the modx api to access the database.
                    (the code for the snippets were imported from a old non-modx site).