do the following:
$db_connection= mysql_connect($hostname, $username, $password) OR DIE('Unable to connect to database! Please try again later.');
And every time you want to request:
mysql_query("my_query",$db_connection);
Please note: if you connect to the database in a function, you will need a global $db_connection .
And when you want to close the database connection:
mysql_close($db_connection);
user849137
source share