doubledee Posted April 29, 2012 Share Posted April 29, 2012 I have a fairly complicated Q&A Form with 10 Inputs. If there is a data entry error, then I re-load the Form display an error-message beneath the corresponding field. No problems there. Normally, if there was a more serious error (e.g. INSERT failed), then I would re-direct to a new page and display the error (or success) message there. No problem again. But here is where I am confused... Because my code iterates through each of the 10 Inputs on my Q&A Form, there could conceivably be an error on each loop. If I had two serious errors (e.g. INSERT error and UPDATE error), then how should I handle displaying the error?! For those types of errors, I would usually re-direct, however there would usually be only one error to display, e.g. Your profile answers could not be added due to a System Error. Should I display every error that might occur for every one of the 10 Input fields, or does it make sense to just display one error, with the understanding that if one thing fails then everything does. Hope that makes sense?! Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/261785-how-to-display-errors/ Share on other sites More sharing options...
xyph Posted April 29, 2012 Share Posted April 29, 2012 Doesn't really matter. It's all preference. You should never get an INSERT or UPDATE error in a production environment. Personally, I see a query error as a fatal error, and would throw an exception or otherwise stop execution of the script. I don't see a reason to continue to check for more potentially script-breaking errors after the first one has occurred. Those will show up after you fix the first one any ways. Quote Link to comment https://forums.phpfreaks.com/topic/261785-how-to-display-errors/#findComment-1341474 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.