troubleshooting Question

php variable and function scope

Avatar of ucsdmbdm
ucsdmbdm asked on
6 Comments1 Solution558 ViewsLast Modified:
I am not sure why the php scope is not working properly.
When I call echo validateaccess('a') from within validateaccess.php, i get the correct result but when I include validateaccess.php and call echo validateaccess('a'), i get no results.
Please take a look at the attached example


/* validateaccess.php */
function validateAccess($st)
			$uid = $_SESSION['MM_User'];
			global $staff;
	   		mysql_select_db($database_staff, $staff);
                         return $access
echo validateAccess('ross')  /* when i call validateAccess from within validateAccess.php i get good result  */
/* topmeu.php */
.... // some html 
		echo validateAccess('ross'); /* this one does not produce any results *?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros