From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Handling database errors gracefully--and securely

Handling database errors gracefully--and securely - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Handling database errors gracefully--and securely

Hopefully you've got to this stage without displaying any database errors onscreen. But errors do happen, so it's important to display error messages when you're testing your web pages. Without them, troubleshooting will be far more difficult if not impossible. But those error messages should be for your eyes only. When it comes to deploying your web pages on a live server, error messages not only look bad, but they might expose information that could lead to a malicious attack on your database. So let's introduce a deliberate error into details php. Go into a editing program, here's details.php. going to scroll up to the top and I'm going to change the name of the table from arrangements to arrangement. That will give me an error. Save that, go back. Mixed arrangements, we'll select one. And, oh, my goodness we've got undefined variable up here, undefined variable oh, we've got mess all over the place. And this type of thing obviously is totally undesirable, but it's a good thing…

Contents