only one Posted February 4, 2007 Share Posted February 4, 2007 i cobe my webasite with includes, like, include("$page.php"); the only problem is when a page doesnt exist i get an error like Warning: main(the page.php): failed to open stream: No such file or directory in the place.php on line 1... is there any way of stoping this from happening without haveing to do a big long list of if's or make up every page possible Quote Link to comment https://forums.phpfreaks.com/topic/37014-non-exisiting-page/ Share on other sites More sharing options...
hvle Posted February 4, 2007 Share Posted February 4, 2007 use keyword '@' to supress error message. for example, $fp = @open("filename.txt", "r"); if filename.txt is not found, no error message is print. Quote Link to comment https://forums.phpfreaks.com/topic/37014-non-exisiting-page/#findComment-176708 Share on other sites More sharing options...
only one Posted February 4, 2007 Author Share Posted February 4, 2007 thx Quote Link to comment https://forums.phpfreaks.com/topic/37014-non-exisiting-page/#findComment-176710 Share on other sites More sharing options...
.josh Posted February 4, 2007 Share Posted February 4, 2007 It's not advisable to suppress errors. Suppressing errors does not fix the problem. Instead, use one if, with file_exists() Quote Link to comment https://forums.phpfreaks.com/topic/37014-non-exisiting-page/#findComment-176711 Share on other sites More sharing options...
only one Posted February 4, 2007 Author Share Posted February 4, 2007 see wen i put the @ infrnt of my include, does that stop any other errors from showing up on the included file? Quote Link to comment https://forums.phpfreaks.com/topic/37014-non-exisiting-page/#findComment-176712 Share on other sites More sharing options...
hvle Posted February 4, 2007 Share Posted February 4, 2007 No, it will only suppress that function on that line, it has nothing to do with any other code. But this should be user as the last option. You should always catch error, null, failure with conditional if.... Quote Link to comment https://forums.phpfreaks.com/topic/37014-non-exisiting-page/#findComment-176723 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.