"Keith Lawrence" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi there, > > I'm a web-developer and I work with PHP as often as I can (it's infinitely > preferable to ASP) and as a result of this I end up coding in lots of > different environments. Our local dev server is a windows machine which acts > differently to the multitude of *nix boxes which our clients run. Some have > safe-mode enabled (apparently a good safety measure for a shared-hosting > solution), some run with magic_quotes on, some with magic_quotes off, > register globals on/off, etc etc ad nauseum. Usually this isn't much of a > problem as I tend to only work on one major project at a time and I can set > up our local windows box to emulate the live server, but it would be very > useful to me if I could ask for your collective knowledge on building an > include file (or class) of common database functions. This class would take > into account whether the server has magic_quotes enabled and cater for it, > different login strings depending on the environment variables (for dev and > live environments) as well as catering for any other strange > platform-dependent niggles that I've left out. It'd also have methods to > fetch: > * just one specific value from the database > * an array of rows from the database > * run an arbitrary query (insert/update/delete) and return success/failure > and optionally populate the identity id/error message/etc. > > I hasten to add that I'm not asking for someone to build this for me, but > rather asking for any pointers/tips for things I should watch out for or > links that might help. I've searched extensively for something like this but > haven't found one that does exactly what I want. Am I re-inventing the wheel > here? Does anyone else who works on multiple platforms have these problems? > > Many thanks (in advance) for any help, > > Regards, > Keith
Hi Keith, using a database abstraction layer would be a good start. There are some good ones in PEAR: http://pear.php.net/packages.php?catpid=7&catname=Database Namely PEAR::DB, PEAR::MDB and PEAR::MDB2. They offer the features you are looking for. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php