Alright so I have this code:
PHP Code:
function userExists($userSet) { $userE = mysql_query("SELECT userID FROM $DBmemberTable WHERE username = '$userSet'"); $userE = mysql_fetch_array($userE); $userE = $userE[0]; echo "-- $userE --"; return $userExists; }
It's a function that grabs the userID from $DBmemberTable where the username is $userSet.
I have $DBmemberTable="members"; in my config.php file, which is included with a standard include(''); statement to the file holding the userExists function.
The database is opened and selected, so that's working fine. What it just can't figure out is what $DBmemberTable is, even though it's in teh include file with nothing fancy. It works everywhere else on my site.
Do includes not work in MySQL? Can you not put MySQL statements in functions? What's the deal 
What really bothers me is if I put $DBmemberTable="members"; right inside the function, it works. But it doesn't seem to know what $DBmemberTable is outside of the function. I can even copy the include('config.php'); statement right into the function and it works, but how can I get it to work without having to call on something that's already been called?
Thanks,
_PG
Last edited by Physicsguy; 07-25-2010 at 06:48 PM..
|