We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20999
    • 20 Posts
    So, I am working on getting a form I wrote working with MODx, and I need to open a seperate database connection to access another database , and when I am done with it, I close it. I kept getting an error saying that MODx could not write to the event log (before I tried closing the connection), and then it says cannot connect with the given user... Anyway the only way I could fix this is to open a new database connection in the logEvent function in manger/includes/document.parser.class.inc.php, but this does not seem like that great idea because I had to put the username and password to the database here. I suppose I could include a .inc file and put the crudentials there, but I am wondering if there is an easy solution to my problem. I posted this question with my "using PEAR templates in snippets" topic in Module, and Snippet usage, but I thought I would put it here too.
      • 22303 MODX Staff
      • 10,725 Posts
      You can create an instance of the dbapi to get a unique connection to the other database, or read about how to use the mysql functions with reference to a unique connection that will not hijack existing ones. I fear if you change the existing mysql connection, you are going to run into a lot more errors than the logEvent issue down the road.