I have been developing a mysql/php db app for editing a relatively large research database for a client whose main site is managed via modx. The app comprises a handful of php pages, includes, etc. and its db is on the same host as the modx db. Now, I’d like to move this app into a module so the client can edit the data from within the modx environment, based on their modx creds. I’d like to do this by using the modx dbapi only to make the connection to this external db and
not have to use the dbapi on all of the subsequent mysql calls. Is this possible? In other words, roughly:
In my config file, make the connection:
$dbname = 'mydb';
$link = (modx code to get conn obj);
mysql_select_db($dbname, $link);
Subsequently, make queries to the db the way you would if modx were not involved:
$query = "SELECT ...";
$result = mysql_query($query);
etc.
The general lay of the land is:
[tt]
/assets/modules/mydbmod
/inc
config.php
header.php
footer.php
start.php (an include of this file is the only code in the module’s setup page)
page1.php
page2.php
page3.php
page4.php
...
[/tt]
What’s happening with the couple of methods I’ve found on the Wiki is the connection does not work on any page other than the start.php page. Once you navigate to any other page, you get an error because the user/pwd is not carried through even though the connection code is included in every page. I get the feeling the solution is simple, but I just have not been able to grab it! Any insight appreciated