PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Here's my problem. At the beginning of a page I connect to the server and select a MySQL database. Now towards the end of the script I need to get information from another database. Should I close the connection to the server from the first database, and open a new one and then select the other database? I tryed using
I get this error:
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\Apache Group\Apache\htdocs\user\edit-profile.php on line 221
What I ended up doing is creating a function that used the mysql_connect() and mysql_select_db() functions. When I needed to connect to a new database I just called my function, passed the database to the function, and I didn't have to bother with closing the server connection to the database. It looked like this: