Page 1 of 1

problems with an include statement

Posted: Tue Aug 15, 2006 2:18 pm
by cmadsen
I am having problems with the following include statement and I know I am overlooking something.

include ('images.php?TypeID='.$typeID.'&ListingID='.$listingID);

This is the error i'm getting. I'm not pulling the last parameter. I put a print $listingID right before this line and the variable printed fine.

Warning: main(images.php?TypeID=42&ListingID=): failed to open stream

Posted: Tue Aug 15, 2006 3:23 pm
by Tom420
You can't pass parameters this way when including a file.

instead of:

include("test.php?var=value");

do:

$var = 'value';
include("test.php");

or, if test.php expects a get:

$_GET['var'] = 'value';
include("test.php");

Hope this helps,
Tom :)

Posted: Tue Aug 15, 2006 3:24 pm
by feyd
include() and its sibling require() use the file system. URL-like query strings aren't supported. The requested script will have access to any previously defined variables.