Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When we went through the Register.php page, which is actually the registration form we were given by the website maintenance people at Scuba2u, to use for our registration form. We discovered that a couple of the fields in our database, that has been setup, are not long enough for the information that needs to go into them. Now, hopefully, this is something that will never occur to you, because this would have all been checked out before the database was created. But I have purposely setup a couple of situations within this course, so I can get you a little more familiar with the PHP My Admin area. This is not something you want to do, generally, when there's data in the database.
So, we'll go out to manage our database. In order to do that, we need to go out to our Zamp or Mamp control areas. And within the MySQL area, I want to go to the Admin page. And this particular page is setup, so we can administer the database. So, let's open that up, and the database I want to administer is Scuba2u, in the left-hand side.
Now, once I choose a database, I could use this drop down in case I choose the wrong one. So, I can move between databases. The table we need to fix is the log-in table. Now, thankfully, we just have some example log-ins within this database tables. I'm in the Browse tab and I have Log In selected in the left-hand side. You can see there isn't any information in the first name, last name and country areas, and since we need to modify these fields, that's a very good thing.
This is not something you want to be doing once there's a bunch of database data within your website. So, it's very important to make sure this never happens within your site. But I'm going to move over to the Structure tab. Now, the Structure tab is used to add columns or fields within the database. And you can see my last name has 11 characters and my country has 11 characters. Let's correct both of those. So, I'll start with last name.
And this little pencil here, if I highlight it, you can see it says Change. When I click on that Change, it has a length of 11. Now, this particular field is the last name field. We want to allow 40. So, I'm going to change the 11 to 40. This is also setup as an integer. I want it to be whatever characters the user wants to put in. So, I will change this to varchar.
And change the length to 40. In order to change it permanently, I click the Save button down in the bottom right. Now, we have varchar as 40. Our country here, also has that same situation, and I will also go in and just check the type for first name. So, this allows you to get an idea of how we build tables within this table structure. As I mentioned, you do not want to be doing this on a live database with data inside of it. So, I'll click the pencil next to country.
This also say's it's an integer, so I'll change it to varchar. And our country, we set our fields to be 30 wide, within our form. And 30 should cover all countries, if we really want to allow that. So, I will set it to 30 as a length, and click Save. You can see these two are now fixed. So, it isn't that difficult to do this. Now, let's correct first name while we're in here.
I click the pencil for first name. And I have the same situation. I'll change it to varchar. Our length is fine. I'll click Save. We have now corrected those issues. All of these are going to allow plenty of text or whatever character's we want to put in especially for the password field. I can close up this interface, set aside my Control panel. And let's do a refresh over here, of our Databases panel. If I open this up, I should see it corrected within this area. And I want the Log In table.
And there we are. We've corrected those issues within PHP My Admin. So now, our registration form matches up with our database data. So, that is how you can administer your database. Now, if this is a big team environment, it's a company website, things are a little bit different. I, as a developer, am not going to go in and go modifying their database. I just wanted you to get a feel for this because sometimes, as a developer, you're the one who has to build the data base as well.
So, I wanted to give you a taste of how to modify table structure within PHP My Admin and which buttons to click, in order to do that. So, our registration form and our log in forms, should be all set up for our log in process at this point in the course.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 100226 Viewers
56 Video lessons · 113206 Viewers
71 Video lessons · 82090 Viewers
131 Video lessons · 39390 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.