Learn how to add code to a database interaction to handle errors when a connection to the database fails, or when a database query results in an error (usually due to a mistake in the SQL syntax).
- [Instructor] Over the last several movies,…we've learned how to connect to a database,…how to make a query for data,…and then how to use that data in our website.…Now, I want to talk about what to do…when something goes wrong in that process…and how can we handle it when it does.…There are two more functions that we're going to to use…from the MySQLi API for this.…The first is mysqli_connect_errno,…that's short for error number,…E-R-R-N-O, short for error number.…And then mysqli_connect_error.…Errorno is going to return the error code…from the last call that we made to connect to the database.…
So, whatever that was,…whatever the last call to connect to the database was,…we're going to be able to retrieve…the error code that was there.…If there is no error code,…then it'll come back and return nothing.…There's nothing there.…The mysqli_connect_error function is going to return…a string description of that last connect error.…So it does the exact same thing,…it looks to see what the error was,…but it also does one additional thing,…
- Organizing project files
- Including and requiring files
- Working with URL parameters
- Encoding dynamic content
- Modifying headers and page redirection
- Creating forms and processing form data
- MySQL basics
- Using PHP to access database tables
- Creating, reading, updating, and deleting database records with PHP
- Validating data
- Preventing SQL injection
Skill Level Beginner
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
1. Start a Database-Driven Project
2. Build Web Pages with PHP
3. Headers and Redirects
4. Build Forms with PHP
5. MySQL Basics
6. Use PHP to Access MySQL
7. CRUD with PHP
8. Validate Data with PHP
9. Prevent SQL Injection
Next steps1m 8s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.