We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27648
    • 3 Posts
    I have my own ADODB object kept in a global var $conn

    inside the snippet I can use it, however in any of the classes that I in the snippet it’s not accessible.

    All other global vars work fine. It’s just this one that craps out.

    Ideas anyone.?

    example
    global $conn ;
    
    $conn->execute($mySql) ; //works fine
    
    $myObj->do_something() ; // inside do_something can't access $conn at all ( I add "global" keyword and all, and nothing)
    
    
      • 4310
      • 2,310 Posts
      Have you tried
       global $modx;
        • 27648
        • 3 Posts
        Can you please explain what for?

        all other globals that I tried worked...
          • 27648
          • 3 Posts
          just to clarify some things
          my $conn variable was a reference,
          and t turned out that modx doesn’t like references in global vars.

          I changed $conn from reference to actual object and it works fine.