me102 Posted January 20, 2009 Share Posted January 20, 2009 Basicly theres input box where people put there database details then on the next page it check the database details and if everythings ok it adds the details to the database. My problem is the 2 database connections are not working together and I was wondering what I could do? include(config.php) $testconnect = @mysql_connect($mysql_host,$mysql_username,$mysql_password); if(!$testconnect ){ echo "error can not connect to database"; }else{ $add = mysql_query(" INSERT INTO DATABASE () VALUES () } config.php $database_a = mysql_connect($host,$username,$password); $database_1 = mysql_select_db($database, $database_a); Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/141553-2-databases/ Share on other sites More sharing options...
corbin Posted January 20, 2009 Share Posted January 20, 2009 What exactly is your problem? Nothing should be wrong with those scripts. By the way, you have to pass the DB link resource into mysql_query if you want it to act on a specific connection. http://php.net/mysql_query You should also know that putting in the same host/port will usually return the same connection. C:\Users\Corbin>php -r "var_dump(mysql_connect('localhost', 'root', 'root')); var_dump(mysql_connect('localhost', 'root', 'root'));" resource(5) of type (mysql link) resource(5) of type (mysql link) I'm not sure what the logic behind it was when the MySQL extension had that coded into it, but that's how it works. Quote Link to comment https://forums.phpfreaks.com/topic/141553-2-databases/#findComment-740948 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.