RSmiroldo Posted March 12, 2008 Share Posted March 12, 2008 I'am trying to use this code <?php include("$id.txt"); ?> to generate content in the certain point in my layout so i can simply link to .txt files in the address bar so they appear in that portion of the layout but I'am currently getting the error Warning: main(.txt): failed to open stream: No such file or directory in /home/content/i/w/s/iwsports/html/index2.php on line 302 I'am so confused any suggestions? Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted March 12, 2008 Share Posted March 12, 2008 are you sure $id was set correctly? Quote Link to comment Share on other sites More sharing options...
RSmiroldo Posted March 12, 2008 Author Share Posted March 12, 2008 Im not exactly sure how would i know? Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted March 12, 2008 Share Posted March 12, 2008 well did u set $id Quote Link to comment Share on other sites More sharing options...
awpti Posted March 12, 2008 Share Posted March 12, 2008 if($id != "") { include("{$id}.txt"); } There you go. Enjoy. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted March 12, 2008 Share Posted March 12, 2008 also: include($id.".txt"); that also works. Quote Link to comment Share on other sites More sharing options...
RSmiroldo Posted March 12, 2008 Author Share Posted March 12, 2008 awpi i put it in just like that and it eliminated the error would i simply link it like this now http://www.islandwidesports.com/index2.php?id=test when i do that nothing comes up.. Quote Link to comment Share on other sites More sharing options...
RSmiroldo Posted March 12, 2008 Author Share Posted March 12, 2008 and also PC nerd i tried putting in <?iphp include($id.".txt"); ?> and it resulted in the same error. Quote Link to comment Share on other sites More sharing options...
trq Posted March 12, 2008 Share Posted March 12, 2008 Use... <?php if (isset($_GET['id'])) { if (file_exists($_GET['id'] . '.txt')) { include $_GET['id'] . '.txt'; } } ?> Quote Link to comment Share on other sites More sharing options...
RSmiroldo Posted March 12, 2008 Author Share Posted March 12, 2008 that worked thank you so very much 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.