troubleshooting Question

Functions with multiple variables avoiding GLOBAL

Avatar of dban00b
dban00b asked on
5 Comments1 Solution272 ViewsLast Modified:
I want this to work:



function dberror($errorString){

mysql_query($queryString) or dberror(mysql_error());



It doesn't work because the $error variables outside and inside the function are in different scopes
I know I can use global variables to make it work (ie: inside the function use "global $error") but I understand that it is taboo to use "global."

Is there another way I could achieve this?  Maybe with variable pointers or some other way?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
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 5 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