NevadaSam
10-7-07, 09:15 AM
It is neccessary to close and reopen the database connection when changing to a different database?
This is what I am doing:
$connect = mysqli_connect($host,$user,$password);
mysqli_select_db($connect, 'mydb_name_1');
// query, result, etc....
// do stuff with mydb_name_1
mysqli_close($connect);
$connect = mysqli_connect($host,$user,$password);
mysqli_select_db($connect, 'mydb_name_2');
// do stuff with mydb_name_2
mysqli_close($connect);
Could I get by without the mysqli_close() and mysqli_connect() in the middle of this script?
Sam
;
This is what I am doing:
$connect = mysqli_connect($host,$user,$password);
mysqli_select_db($connect, 'mydb_name_1');
// query, result, etc....
// do stuff with mydb_name_1
mysqli_close($connect);
$connect = mysqli_connect($host,$user,$password);
mysqli_select_db($connect, 'mydb_name_2');
// do stuff with mydb_name_2
mysqli_close($connect);
Could I get by without the mysqli_close() and mysqli_connect() in the middle of this script?
Sam
;