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 - PHP Tutorial
From the course: PHP for Web Designers
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Loading data into MySQL5m 37s
-
(Locked)
Connecting to the database7m 47s
-
Querying the database6m 15s
-
(Locked)
Displaying the results of the query3m 50s
-
(Locked)
Using modulo division to establish a repeating series4m 20s
-
(Locked)
Repeating output at specific intervals in a loop4m 56s
-
(Locked)
Linking to a details page2m 40s
-
(Locked)
Embedding a variable in a query securely6m 5s
-
(Locked)
Handling database errors gracefully--and securely8m 40s
-
(Locked)
-
-