You need to reconnect everytime you enter a new page. If you store the connection data in, let's say a cookie or a session, you take a big risk that your clients will get to know the login data and abuse it.
I usually make a config.php where I put in all my global functions and external connections. Then include config.php in every file I will load, and call the database_connect function whenever I need it.


Click and join the 3dgs irc community!
Room: #3dgs