NYCPHP Meetup

NYPHP.org

[nycphp-talk] different sites, one database

Henry Ponce henry at beewh.com
Wed Jul 13 12:14:44 EDT 2005


Sure:

the script to test is running in:
	http://www.chess.ac/mysql_test.php
You can see the errors i get there.

from www.chess.ac, I want to connect to a database in www.calchess.org. Both 
these sites are on the same server (same IP).

And here is the mysql_test.php code (I hope it is not too much, if it is, 
sorry....)

<?	
	/* connect to chess.ac database */
	$CFG_SERVER = "localhost";		
	$CFG_USER = "chess_ac";
	$CFG_PASSWORD = "";
	$CFG_DATABASE = "chess_ac";	
	$dbh = mysql_connect($CFG_SERVER, $CFG_USER, $CFG_PASSWORD);

	mysql_select_db($CFG_DATABASE);
	$q = 'select * from chess_bio_invited';
	$res = mysql_query($q);
	while ($row = mysql_fetch_array($res)){
		echo $row["user_id"];
		echo '<br>';
	}

	mysql_close($dbh);
	
	// connect to calchess.org database
       $host = "calchess.org";       
       $user = "chesshustler";
       $pass = "";
       $link = mysql_connect($host, $user, $pass);
       $db = "chessdb";
       mysql_select_db($db);
	$q = 'select * from chess_bio_invited';	
	$res = mysql_query($q);
	echo 'CALCHESS DATA';
	echo '<br>';
	while ($row = mysql_fetch_array($res)){
		echo $row["user_id"];
		echo '<br>';
	}
	mysql_close($link);	
?>

Thank you all for your help.
Henry



More information about the talk mailing list