Re: [PHP] Passing variables with include()

2002-01-14 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* On 14-01-02 at 13:01 
* Imar de Vries said

 Hi all,
 
Hello!

 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.
 
 
 But for some reason, i simply do not get the script to work. I use a
 form in the local script to determine which standings are to be shown,
 and the value is stored in $serie_id. This is done in the main scope (no
 function used). $serie_id can be 2, 3 or 4.
 
 Then I make an include call to the remote script:
 
 include(http://www.someremote.server/calculate_drivers.php;);
 
 In that remote script I use $serie_id to make a database query. But so
 far, the query fails because $serie_id is not known.
 
 Are there any known exceptions (f.i. specific server settings) that
 might explain why the variable is not known on the remote server?
 
 Thanks in advance!
 --
 Imar de Vries - [EMAIL PROTECTED] - ICQ 6972439

Are you absolutely certain that the var is being set properly?
Try printing it to the screen just before you call the script.
- -- 

Nick Wilson

Tel:+45 3325 0688
Fax:+45 3325 0677
Web:www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QspAHpvrrTa6L5oRAistAKCmkjCwFRXf57JBwRn2gA65vyr6EACgiOqu
kmrKG/BaSZtyMcaIUa/xWT8=
=X8wX
-END PGP SIGNATURE-

-- 
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]




Re: [PHP] Passing variables with include()

2002-01-14 Thread Stefan Rusterholz


- Original Message -
From: Imar de Vries [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 14, 2002 12:53 PM
Subject: [PHP] Passing variables with include()


 Hi all,

 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]

 But for some reason, i simply do not get the script to work. I use a
 form in the local script to determine which standings are to be shown,
 and the value is stored in $serie_id. This is done in the main scope (no
 function used). $serie_id can be 2, 3 or 4.

 Then I make an include call to the remote script:

 include(http://www.someremote.server/calculate_drivers.php;);

I'd make a bet (I haven't tried it) that you receive the file already parsed
and so as pure html.
Try it with the extension .txt or something that the remote webserver
doesn't process before it outputs the content.


 In that remote script I use $serie_id to make a database query. But so
 far, the query fails because $serie_id is not known.

 Are there any known exceptions (f.i. specific server settings) that
 might explain why the variable is not known on the remote server?

 Thanks in advance!
 --
 Imar de Vries - [EMAIL PROTECTED] - ICQ 6972439

best regards
Stefan Rusterholz


-- 
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]




RE: [PHP] Passing variables with include()

2002-01-14 Thread Rick Emery

Does http://www.someremote.server/calculate_drivers.php; contain a
function?  If so, you may have to declare $serie_id as global within it.

-Original Message-
From: Imar de Vries [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 14, 2002 5:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing variables with include()


Hi all,

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]

But for some reason, i simply do not get the script to work. I use a
form in the local script to determine which standings are to be shown,
and the value is stored in $serie_id. This is done in the main scope (no
function used). $serie_id can be 2, 3 or 4.

Then I make an include call to the remote script:

include(http://www.someremote.server/calculate_drivers.php;);

In that remote script I use $serie_id to make a database query. But so
far, the query fails because $serie_id is not known.

Are there any known exceptions (f.i. specific server settings) that
might explain why the variable is not known on the remote server?

Thanks in advance!
--
Imar de Vries - [EMAIL PROTECTED] - ICQ 6972439



-- 
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]

-- 
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]




RE: [PHP] Passing variables with include()

2002-01-14 Thread Mark Roedel

 -Original Message-
 From: Imar de Vries [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, January 14, 2002 5:53 AM
 To: [EMAIL PROTECTED]
 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:

[quote]
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. 
[/quote]
 
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]