In article <8b*************************@posting.google.com> ,
ac*****@yahoo.com (A Cate) wrote:
I am new to PHP. I am trying to develop a web site on a development
machine that needs to access data in a mysql database. I have mysql
running on my development machine with a copy of the database. While
developing the app. I can connect to the local version of the database
without problems. Once I upload the database to its host site I need
to change the php scripts that connect to the database to refelect the
appropriate connection associated with the hosting server. Does
anyone know of an efficient way to have my script test for which
location it is on and connect to the appropriate mysql database? Or,
does anyone know of a php script that can handle this
programmatically? Thanks for any time in advance.
A. Cate
I put code in all the relevant scripts to test the URL, which is
different between the development and production systems. All database
access is done in a single class that's included in various files that
need access to the database. That way, I can make one change to the
class and it changes everywhere.
If you don't have programming skills, start reading some basic books on
programming design that discuss larger projects. Such practices like
putting things in header files, reusability, etc. are key to making
something easy to modify and maintain. Since I already have programming
experience, I found the O'Reilly book useful and the PHP Anthology to be
very useful to discuss OOP:
http://www.oreilly.com/catalog/progphp/ http://www.sitepoint.com/books/phpant1/
--
DeeDee, don't press that button! DeeDee! NO! Dee...