Re: Remote MySQL connection via PHP file

From: Date: Fri, 01 Dec 2006 19:40:36 +0000
Subject: Re: Remote MySQL connection via PHP file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-245417@lists.php.net to get a copy of this message
i suggest you: database.conf (the file on another server) host=localhost user=test pass=test anothervar=anothervalue on your script: $temp = file(http://....../database.conf); foreach($temp as $val) { $temp2 = explode("=",$val); $$temp2[0] = $temp[1]; } after that, you`ll have: $host = 'localhost' $user = 'test' $pass = 'test' $anothervar ='anothervalue'; mysql_connect($host,$user,$pass); (bla bla) hope this help; On 12/1/06, Scott <svinkle@gmail.com> wrote:
Hi all, I've been searching around for a while, but cannot find a solution. For a project of mine, I need to keep the connection information to a MySQL server database on another server. Example remote file: <?php $user = "joe"; $pass = "1234"; ?> Example local file: <?php include "http://www.remoteserver.com/remote_file.php"; // Use variables $user and $pass somehow... ?> I've tried including the file which has the username/pass, etc information via HTTP, but this doesn't seem to work. I assume because it returns what a web browser would return if this file was loaded into one, a blank screen. I've tried using the return statement in the file which houses the information, but this seems to return a boolean value (1 or 0)... not sure what's up with that. Any help with this would be most appreciated. Thank you. Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#245417) next »