Re: using require or include?
| From: | John Nichel | Date: | Fri, 05 Nov 2004 01:22:44 +0000 |
| Subject: | Re: using require or include? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201246@lists.php.net to get a copy of this message | ||
Reinhart Viane wrote:
i have made a page (overall.php) in which several elements are defined: the connection with the database a function called session_checker to check if users are logged in and a last function(function getuserinfo()) that substracts values from the database based on the session variables of the logged in user Now this last function sets 2 variables eg. $username=$row['user_name']; $userstatus=$row['user_status']; like this i do not have to recall this script on every page but i just can do the function at the top of every page Now on every page of my site I require this file require(overall.php); But it seems that i cannot get the variables outta this file. So i can not use $username or $userstatus on the pages. I think it has something to do with require not passing the variables? Off course i can repeat the function script on the top of every page, but that's stupid i think. Can i use a include without any problems? Or is there a significant difference in use and security? <snip>Scope. http://us4.php.net/manual/en/language.variables.scope.php -- By-Tor.com It's all about the Rush http://www.by-tor.com