I created a centralized script that specified a MySQL DSN & created a $dbh (database handle) for any db-aware scripts to require. I have two different sites running @ work - a production server and a development server (running on a higher port & different DocumentRoot directory).
So the script uses the caller() function and based on the filename ((caller())[1]), creates a DSN pointing to the right port of the MySQL server (I also have 2 MySQL servers running on different ports [& different data directories! ;)]). Debugging, I found the DSN is being created right, but whenever a dev server script does db stuff, it messes w/ the production MySQL server... boggles me mind!
Any ideas out there? Comment away!