thosecars82 Posted April 4, 2008 Share Posted April 4, 2008 Hello people does anyone have any idea to test a php application using database first in local and afterwards in the remote server? What i mean is, does anyone know how to do it without having to change the code used to get the connection to the database. My code to connect to the database looks like this: //$miconexion->conectar("jorlal8_nueva", "mysql4.freehostia.com", "jorlal8_nueva", "******");//remote $miconexion->conectar("jorlal8_nueva", "localhost", "jorlal8_nueva", "******");//local Each time i want to test on remote I have to comment the line to connect to mysql in localhost so that I can be testing at the remote mysql database which in my case is in freehostia. But if i want to test later at localhost i'll have to change the code again. Does anybody knows how to do this? Someone told me that he used application variables to know whether the code was running local or not. Besides he told me another posibility which was using xml tags to distinguish between debugging and normal run of the application. Nevertheless, I am still very lost. Please I would appreciate any help about this. Thank you Link to comment https://forums.phpfreaks.com/topic/99544-connecting-to-mysql-databaseeither-remote-or-local-from-php-application/ Share on other sites More sharing options...
craygo Posted April 4, 2008 Share Posted April 4, 2008 set some variables up top $user = ""; $password = ""; $host = ""; $db = ""; $miconexion->conectar($user, $host, $db, $password); Now all you have to do is change the variables up top. I hope I got the order correct Ray Link to comment https://forums.phpfreaks.com/topic/99544-connecting-to-mysql-databaseeither-remote-or-local-from-php-application/#findComment-509231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.