From the course: PHP: Object-Oriented Programming with Databases
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Find by username - PHP Tutorial
From the course: PHP: Object-Oriented Programming with Databases
Find by username
- [Narrator] In this movie, we're going to learn how to find admin records using the Username column, and then use that as a validation to confirm that a username is unique before we accept it into the database. We already have a validation function placeholder for this, go to our validation functions.php. There's has unique username, and that's what we had before when we were working in php with mySQL essential training. But we need to now rewrite that using object oriented programming. So, let's think about how we would do that. The first thing we need to do, is we need to get an admin, and we would do that by asking the adman to return a user to us. So we would need to have admin class and then find the user, so we can't use Find all, and we can't use find by ID, we're going to need to write a new one, which is find by username. And we'll need to pass in the username that's been sent in to this validation, so that we can then pass that on to the class and see if we find this user…
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)
Admin class7m 40s
-
Hashing passwords7m
-
(Locked)
Admin validations7m 16s
-
(Locked)
Find by username5m 55s
-
(Locked)
Verify password5m 5s
-
(Locked)
Define a session class8m 34s
-
(Locked)
Add page access control4m 52s
-
(Locked)
Improve the session class7m 39s
-
(Locked)
Session messages6m 40s
-
(Locked)
-
-