We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27302
    • 154 Posts
    I just tried it, but all I got was a totally blank page.
    • Very interesting. Just to make sure this is working as expected, change that echo to "echo ’Hello’; exit();" and see if you get Hello to the screen.
        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
        • 7923
        • 4,213 Posts
        Quote from: SimonMW at Jan 29, 2008, 08:08 PM

        Can I just check if this is the full line you meant?
        $query=mysql_query("DESC $mg->pics_tbl") echo $query; exit();


        As you can probably gather I don’t know much about PHP smiley
        Just to be sure..

        You did put that "echo $query; exit();" line in the maxigallery snippet code (to maxigallery.php file) below that $query=mysql_query("DESC $mg->pics_tbl") line? right? and there is an semicolon after the maxigallery mysql_query line?

        Eg.
        //validate gallery table
        $query=mysql_query("DESC $mg->pics_tbl");
        echo $query; 
        exit();
        if(!$query) {...
        



          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 27302
          • 154 Posts
          Yep. Just tried that and it displayed the Hello message.

          Just realised that this is on a new page. I deleted the old gallery that didn’t work and tried to create a new one to see if I would still get an error. It threw up the SQL error again, and because of that I couldn’t add any pictures to the new gallery. Could this be why it is blank?
          • We will presume that there is an sql error. Replace that echo line with this one and see what it says.
            echo mysql_error(); exit();
              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
              • 27302
              • 154 Posts
              Okay, that just displayed this;

              SELECT command denied to user ’fiveep_Forumadmi’@’localhost’ for table ’modx_maxigallery’

              What I do not understand about this is why the forum admin bit is there as the forum uses a seperate database to the main Modx site.
              • There you go. The mysql user you are using does not have permission to query the database. Or that table, at any rate.
                  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
                  • 27302
                  • 154 Posts
                  Yeah. The trouble is, I don’t know how it got set like that, or how to change it back. Hmmmmm, very odd!
                  • Try something. Get rid of the echo and exit stuff. Change the mysql_query to $modx->db->query (just that, leave the rest of the line as it is)
                      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
                    • We know that the MODx database connection is good, or else your pages wouldn’t work at all. So perhaps your forum is opening its own database connection that’s hanging around, and since this is using the generic "mysql_query" it’s sort of inheriting that leftover connection. My hope is that using the modx database API like this will cause it to use the MODx connection instead.
                        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