> -----Original Message-----
> From: Imar de Vries [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, January 14, 2002 5:53 AM
> Subject: [PHP] Passing variables with include()
> at this moment I am working on a script that calculates 
> standings of our online racing competition. In order to
> do that, I have to connect to a database on a remote server.
> I have read in the php manual that
> [quote]
> When a file is include()ed, the code it contains inherits the
> variable scope of the line on which the include() occurs. Any 
> variables available at that line in the calling file will be
> available within the called file. If the include() occurs inside
> a function within the calling file, then all of the code contained
> in the called file will behave as though it had been defined inside
> that function.
> [/quote]

This is only true for include()s that occur on a local file.  

The next paragraph from the manual contains the information that you'll
actually need:

If the include()ed file is called via HTTP using the fopen wrappers, and
if the target server interprets the target file as PHP code, variables
may be passed to the include()ed file using an URL request string as
used with HTTP GET. This is not strictly speaking the same thing as
include()ing the file and having it inherit the parent file's variable
scope; the script is actually being run on the remote server and the
result is then being included into the local script. 
The distinction is:

When you include() a local file, the parser will insert the *code* from
that file into your script, and it will behave just as if the code
itself was typed in at that point.

When you include() a remote file, all the parser has access to is the
*results* of the remote file request.

Mark Roedel           | "Blessed is he who has learned to laugh
Systems Programmer    |  at himself, for he shall never cease
LeTourneau University |  to be entertained."
Longview, Texas, USA  |                          -- John Powell

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to