Jump to content

Failing to open an included file


db530

Recommended Posts

Alright, I have no idea why this won't work. I'm using PHP5, it worked fine on PHP4. I get this error when I'm trying to include another php script:

 

Warning: include(product_other_details.php?pid=774&d_type=details) [function.include]: failed to open stream: No such file or directory in /data/16/1/57/83/1546246/user/1664829/htdocs/product_info.php on line 296

 

Warning: include() [function.include]: Failed opening 'product_other_details.php?pid=774&d_type=details' for inclusion (include_path='.:/usr/services/vux/php5/lib/php') in /data/16/1/57/83/1546246/user/1664829/htdocs/product_info.php on line 296

 

You can see for yourself at: http://www.industrialpc.com/product_info.php?pid=774

 

Here is the line (296) in the code: include "product_other_details.php?pid=$_GET[pid]&d_type=$dtype" ?>... that seems to be working because in the error it gives 'product_other_details.php?pid=774&d_type=details' whick works.

 

Anyway, I've changed the .ini file so include is on, checked to make sure the page thats being included is there. Any other ideas? I'm totally lost, thanks for any help.

Link to comment
Share on other sites

Are you trying to include the GENERATED version? As in the copy you would see in a browser? You need to use a URL for the include

 

What do you mean use a URL for the include? Yes I want to include the generated version if this is what you mean: http://www.industrialpc.com/product_other_details.php?pid=774&d_type=details

 

that should be in the box where the errors are coming up on http://www.industrialpc.com/product_info.php?pid=774

 

thanks for the response

Link to comment
Share on other sites

The include you are using:

include("product_other_details.php?pid=774&d_type=details");

will try to include the local file with the PHP code in it, not what you see in your browser

 

I'm lost. Do you know how I can fix this?

Link to comment
Share on other sites

Use the full URL:

include("http://servername.com/product_other_details.php?pid=774&d_type=details");

 

hmm, well that got rid of the error messages but now it is just blank. Should I have some type of statement like echo for it to actually show up on there? this is just driving me nuts because it worked before. I appreciate the help

Link to comment
Share on other sites

Really, you shouldn't be doing an include like that...You should wrap everything up into a function that returns the HTML, then use the function on both pages. Then, you can pass the data (pid, d_type) as arguments.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.