This is the code for config.php I am including this file in all php files:
<?php
$db_name = 'localhost';
$db_user = 'XXXXXX';
$db_pass = 'XXXXXXXXXX';
function db_connect1()
{
global $db_name, $db_user, $db_pass;
$conn = mysql_connect($db_name, $db_user, $db_pass);
mysql_select_db('test1', $conn) or die('Could not select database.');
return $conn;
}
db_connect1();
?>
Here i need to connect with another one database test2.
You can make multiple calls to mysql_connect(), but if the parameters are the same you need to pass true for another connection
Then to query database test1, do this:
and for database test2:
?>