Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
After preparing your custom forms for data management, the next step is to make sure your database structure matches the requirements of your forms. I'm going to go to phpMyAdmin for this step. If you're working with WampServer, open the Administration menu from the system tray icon and choose phpMyAdmin. If you're working with MAMP on Mac OS X, go to the MAMP homepage and click phpMyAdmin from there. Then go to the explorecalifornia database and from there, to the explorers table.
Then click Structure, at the top. This screen shows you everything you need to know about the structure of your database. For variable character fields, it'll show you how wide the fields are. It'll show you what data types are being used, for instance, the dob column is a date field, and most importantly for this exercise, it will show you which columns you can leave null, or empty, and which columns require values. It's very common for there to be mismatches between the database structure and the requirements of a data entry form.
I'm going to go back to a form that I've shown already, explorerinsert.php in the explorers folder. This form contains only a certain number of controls for the various columns. There are controls for first name, last name, date of birth or dob, e-mail, address, city, and state. But there aren't controls for any of the others, and this can cause a problem in a database table that requires values. For example, these three columns, username, password, and tours, have their null property set to No, meaning that you can't leave them blank.
Similarly, the city column is set to No, and the e-mail column is set to No. If you don't apply validation in the form, you need to match up the requirements of your data entry form to the requirements of your database. So I'll show you how to make this adjustment in the three columns that can be affected by my particular data entry form. I'll go to the username column, and I'll click the Pencil icon to change it, and I'll select the Null option, meaning that that column can be set to Null, and I'll save it, and I'll repeat that process, first for the password, and then for tours.
Just to be on the safe side, you can go through and do exactly the same thing for the e-mail address and for the city. I'm going to leave the firstname and lastname set to No, meaning they can't be left null. And the one column that you must leave set to No is the explorerId. A primary key column must contain a value; there are no exceptions to this rule. So once you've set your database structure and matched it up to the requirements of your data entry form, you're ready to apply a server behavior to the data entry form to insert or update data.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97508 Viewers
61 Video lessons · 84747 Viewers
71 Video lessons · 68923 Viewers
56 Video lessons · 101377 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.
Your file was successfully uploaded.