I’ve got a parent page which has some tabbed content. I’m using AJAX to load the content of each tab to speed up the parent page’s load time. The parent page loads a DB connection file but it seems that the page(s) loaded by AJAX don’t utilize the parent page DB connection.
Is this possible? Are there security issues with doing so? Should I just include the DB connection file in each tab file?
If the database connection is not getting loaded on all of the pages, you could use a require_once to a page containing the database info. That would make sure it gets loaded, but not more than once (which would cause errors) if it is possibly loaded somewhere else.
You are not passing the db connection info in ajax – you should be merely connecting to a page that has the db connection info (loaded by require_once on the php ajax-receiving side).