I start by declaring my includes via require (eg. require("lib/auth.inc.php")) and then establish $connection = @ mysql_connect($sqlhost,$sqluser,$sqlpw). My problem is that any functions that I call from the included file has to be given a $connection parameter. The function won't inherit $connection's value from outside of itself.
example:
require("lib/auth.inc.php");
--- inside required file under validateUser function---
if (!($sqlresult = @ mysql_query($sqlquery,$connection)))
showerror();
if (!($connection = @ mysql_connect($sqlhost,$sqluser,$sqlpw)))
showerror();
if (!mysql_select_db($sqldb,$connection))
showerror();
validateUser($username,$password)
For it to work, I have to reform the function as validateUser($username,$password,$connection.)