iandotcom Posted May 1, 2007 Share Posted May 1, 2007 Hey, I made a commenting app for my website, and I'm having problems with the include for it to be embedded on its parent page. <?php include ("../iandotcom/comments/comments.php?id=1"); ?> Its probably really simple, I'm quite new to PHP. I'm running this off my localhost, so thats the root. Quote Link to comment Share on other sites More sharing options...
clown[NOR] Posted May 1, 2007 Share Posted May 1, 2007 have you tried single quotes? ' Quote Link to comment Share on other sites More sharing options...
iandotcom Posted May 1, 2007 Author Share Posted May 1, 2007 Same result Heres the error message when it fails: Warning: include(../iandotcom/comments/comments.php?id=1) [function.include]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\iandotcom\about\index.php on line 79 Warning: include() [function.include]: Failed opening '../iandotcom/comments/comments.php?id=1' for inclusion (include_path='.;C:\Program Files\xampp\php\pear\') in C:\Program Files\xampp\htdocs\iandotcom\about\index.php on line 79 Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted May 1, 2007 Share Posted May 1, 2007 failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\iandotcom\about\index.php on line 79 You need to read and interpret the errors you receive if you want to excel as a developer. This is telling you that the file you are trying to include does not exist. "But it does exist!" you say. "I can see it in windows explorer!" Well, in that case you're probably using the wrong path. <?php include ("./comments/comments.php?id=1"); ?> Quote Link to comment Share on other sites More sharing options...
Koobi Posted May 1, 2007 Share Posted May 1, 2007 i believe include and require (and their variants) use the filesystem to include the file so when you pass _GET variables, it will probably search the file system for a file with that name, your code probably is looking for a file named 'comments.php?id=1' but only 'comments.php' exists. you'd typically use include or require if you want to include the raw PHP code to be processed on the page. you could try this: <?php $_GET['id'] = 1; include ("../iandotcom/comments/comments.php"); ?> that might work for you if your code looks for a _GET['id'] to process whatever it is you are processing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.