web publishing magazine

local/remote switch in your PHP code

If you develop your PHP application locally with MAMP PRO and then publish it on your live server, there will be some differences. One difference would be your MySQL access data, such as your user name and login. When you publish a WordPress installation, MAMP PRO automatically takes over these changes for you. But the world is not just WordPress. The following example shows how to define the credentials for your MySQL database to work both locally and remotely:

Of course, this technique is not limited to this example. You can use it whenever you need to.