Hi,

I need to connect to two different databases ina php file and I use require_once() function to include database connection files. For example:


require_once(first_database);
Handle fisrt data

require_once(second_database);
Handle second data


And I found the first database connection is still alive after I include the second databse file, I have tried mysql_close() function but it still did not work. Can anyone tell me how to close the database connection in this situation??

Thanks in advance.

Erick

    Did you pass mysql_close() the connection resource variable? If not, try that. For example:

    <?php
    
    $conn = mysql_connect (...);
    
    ...
    
    mysql_close ($conn);
    
    ?>
    

    Hope this helps.

    Cheers,

    Lux

      Write a Reply...