JimDarr Posted May 11, 2020 Share Posted May 11, 2020 I am using an inclue file on my layout.php page. I'd like to ignore the include file if the DB connection therein fails. How should I do this? Quote Link to comment Share on other sites More sharing options...
maxxd Posted May 11, 2020 Share Posted May 11, 2020 It sounds like you're saying that the DB connection is in the include file, but you'd like to not include the include file if the DB connection in the include file fails? You can't not include a file after you've included it, and you'll have to include it to see if the connection is successful. What's the actual issue you're dealing with? Quote Link to comment Share on other sites More sharing options...
JimDarr Posted May 11, 2020 Author Share Posted May 11, 2020 Yea that's it in a nutshell! I guess I'll need to think of another approach. I was hoping to return null or something from include if it fails and in layout file do something like: if( response not null ) display response else carry on with layout.php Not a great explanation on my part, newibe as if its not clear! Quote Link to comment Share on other sites More sharing options...
maxxd Posted May 11, 2020 Share Posted May 11, 2020 You can do exactly that; you just need to do some error checking and handling. 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.