Reputation: 342
I ma having this code
<?php include ("commentsdisplay.php?postid=".$activity[$i]['PostId']."&category=".$activity[$i]['Category']) ; ?>
but php is generating a fatal error. Is this syntax wrong?
Warning: include(commentsdisplay.php?postid=17&category=article):
failed to open stream: No error in C:\wamp\www\Spiralblog\home.php on line
79
Call Stack
# Time Memory Function Location
1 0.0015 253760 {main}( ) ..\home.php:0
Upvotes: 0
Views: 35
Reputation: 686
You can't pass parameters to an include like that.
Read the first answer on this question posted a while ago: https://stackoverflow.com/a/1232114/4296515
Quote from : @Daff
Imagine the include as what it is: A copy & paste of the contents of the included PHP file which will then be interpreted. There is no scope change at all, so you can still access $someVar in the included file directly (even though you might consider a class based structure where you pass $someVar as a parameter or refer to a few global variables).
Upvotes: 1