Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • never use require_once. use require Commented Jun 10, 2011 at 18:12
  • 3
    @yes123: Why's that? Most of the answers here seem to claim that that's a myth. Commented Jun 10, 2011 at 18:14
  • 1
    If you still use the old mysql_ interface functions, you don't have to pass the connection handle around. If there is only one opened, it is used implicitly. (Unless you pass a null value.) Commented Jun 10, 2011 at 18:15
  • 1
    @require_once: It might indeed be a cause of the troubles here, because the myglobals.php script is really just loaded once, where OP might have intended it to be included multiple times. (The general disadvisal makes no sense however.) Commented Jun 10, 2011 at 18:16
  • 1
    @mario: except that the OP isn't using include[_once] inside of a function. The OP is including it at the top of each file, which no matter how you cut it would still require the use of the global modifier to use those variables within functions. Commented Jun 10, 2011 at 18:27