atrum Posted March 27, 2010 Share Posted March 27, 2010 So, I have been trying to keep track of all my error messages for the login, and register functions. I thought about using a switch statement. something along the lines of switch(ERROR_MSG) {case err1: $error = "some error!"; break; case err2: $error = "another error!"; break; etc etc etc.................................... } echo $error; Somehow that doesn't feel very practical. Can anyone recommend a method for managing my error messages? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/196680-custom-error-management/ Share on other sites More sharing options...
ignace Posted March 27, 2010 Share Posted March 27, 2010 There are a few ways you can do this however how do you want to keep track of these errors? Do they go into a file? multiple files? Please be more specific Quote Link to comment https://forums.phpfreaks.com/topic/196680-custom-error-management/#findComment-1032648 Share on other sites More sharing options...
Matthias_ Posted March 27, 2010 Share Posted March 27, 2010 Hmm, why not use: $errors = array(); $errors[] = "Error1"; $errors[] = "Error2"; etc.. then foreach($error as $errors) { echo $error; } Quote Link to comment https://forums.phpfreaks.com/topic/196680-custom-error-management/#findComment-1032672 Share on other sites More sharing options...
atrum Posted March 30, 2010 Author Share Posted March 30, 2010 There are a few ways you can do this however how do you want to keep track of these errors? Do they go into a file? multiple files? Please be more specific Sorry, I posted that one in a rush. I was thinking of keeping the errors in a separate file, that I could throw into an array, and then use a switch to pull the right error from the array and display it on the default master page. I want to keep my application as "pretty" as I can so that no errors on plain white screens will happen. Quote Link to comment https://forums.phpfreaks.com/topic/196680-custom-error-management/#findComment-1033870 Share on other sites More sharing options...
Matthias_ Posted March 30, 2010 Share Posted March 30, 2010 Then why not use what I said? I use it too on my sites, it's not errors on a white page. I just echo all the rest again, with the errors in it. It looks pretty cool to be honest. Quote Link to comment https://forums.phpfreaks.com/topic/196680-custom-error-management/#findComment-1033956 Share on other sites More sharing options...
ignace Posted March 30, 2010 Share Posted March 30, 2010 Do you want to store the error's? Or do you want to display them directly? Quote Link to comment https://forums.phpfreaks.com/topic/196680-custom-error-management/#findComment-1034109 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.