When users log into my webpage, how do I declare the database connection so that different pages will be able to access the page instead of opening and closing a connection all the time??
At the moment I have this connection, (this is just a local connection to an access database at the moment whence no username and password defined):
//opening
$conn=odbc_connect('ProjectTestDbase','','');
(!$conn) ? exit("Connection Failed: " . $conn) : (print '');
.....
.....
....
....
//closing
odbc_close($conn);
but on every page
I have attempted to declare that on the first page and then use
$GLOBALS["conn"];
on other pages, but iget the following error:
Supplied argument is not a valid ODBC-Link resource
I assume that it's because the page cannot 'see' $conn
Can anyone help with this??
much appreciation