Forum Moderators: coopster

Message Too Old, No Replies

Php problem

include Problem 2 Question

         

ikbenhet1

7:10 pm on Jan 5, 2003 (gmt 0)

10+ Year Member




Hello,
I Have been working on 2 files that return queried results and put it in an php array.
Now I want to Execute both these php files through run.php with:
<?PHP
include('test.php?keywords=links');
include('test1.php?keywords=links');
?>
But this gives an error because of the "?keywords=keyword".

Now, This way(below) it does work, but now i can't pas variables throug the url:
<?PHP
include('test.php);
include('test1.php);
?>

Question 1:
Is there a way to include a php file with a query in it like:
<?PHP
include('test.php?keywords=links');
?>

Question 2:
When file(test.php) is included in a file: run.php and(test.php) puts some results in an array, can run.php access that array?

andreasfriedrich

7:59 pm on Jan 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For an answer to your first question see example 12-5 [php.net] on php.net.

This should answer your second questions:

When a file is included, 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, from that point forward.

[php.net...]

Andreas