Learn about restoring the Database in MySQL in this Adobe Dreamweaver CS3 Advanced training video series.


More DIY videos at 5min.com

Video Transcription

Restoring the database is a relatively simple process and you will find a copy of it in the Chapter 02 folder in your Project Files. I have included additional copies of the database in each of the Project File folders, where we will be using the database to build the site. That's just in case you jump ahead to one of those lessons, but you should know that you only need to do this step once, if you are following along with this series. To restore the database, choose the Restore option here on the left if you are on a PC or at the top if you are on a Mac, and Browse to find the database file. Choose the Restore Content tab and then Browse to find the database file using the Open Backup File button. In your Project Files, you will find the same file in Chapters 02, 03, 04, 05, 06, and 07. You can use any version of it. I will use Chapter 02 because we are working in Chapter 02. Once you have identified the file, simply choose Start Restore. It should be a very quick process. Once the database is restored, you can now view it in the MySQL Administrator or in the MySQL Query Browser. The MySQL Query Browser is great for setting up queries, testing, and its an excellent tool for looking at and editing data in a database. So let's launch the Query Browser. Again, if you are on a PC, you can go to the Start Menu, choose MySQL, and then choose Query Browser. If you are on a Macintosh, again, you will find this in your Applications folder. Username should be root, unless you have changed it to something else. Password is the password you setup when you installed the program, unless you have setup a specific user for this database. Notice now that the Default Schema is set to jump_start; that's our database. When I click OK, you now see all of the tables in my database listed here in the Query Browser. This is a relatively simple database, but it does have five different tables; one for events, one that lists all of the information about the staff, another one unique to the staff_photos, then I have staff_types, and finally a table for my testimonials. Essentially, any database is just a collection of information complied in one or more tables like this. Each table has multiple records that are organized in columns. Now, before I go into the tables in this database, I want to distinguish between HTML tables, which are used for formatting content on a web page, and tables within a database, which are used to organize the data and the database itself. We will be working with both of these kinds of tables, because Dreamweaver uses HTML tables to format tabular data and display it on a web page, but that's very different from the database tables that you see here. If you want to view the contents of a database table, like our staff table, the easiest way to do that is to click to select the table and drag it up to the Window at the top. Once you see this text appear here at the top, you can simply choose the Execute button and display the contents of the table. Now, if I expand the browser, you can better see what's in this table. I am going to take just a moment to explain the basic structure of this table. I won't go through every element of this database, but I think that if you understand a little bit about how the database is structured, the rest of the series will make more sense as we use this data in our web pages. So taking a quick look here at the staff table, you see at the far left we have a staff_id. This is a unique identifier, and it's important in any table that you have some unique identifier to distinguish each of the columns in that table. The type_id is something that I setup to distinguish between agents and models, and you will see this come up several times in the rest of the series. The type_id corresponds to the staff type table and this is how we distinguish between the agent and the models. So I have designated that a 1 means an agent and a 2 means a model. Using 1 and 2 makes it easier in the future if we decide to add another option, like say photographer as another staff option, which may be we would identify as 3. I am not going to get too deep into how you setup a database. There are many different ways to do this kind of thing, but using 1 and 2 here instead of the words agents and models, makes this database a little more flexible in the future if we choose to build on it. I want to point this out too, because I think the more you understand about the database that's behind your website, the better you can understand the different things you will have to do in ColdFusion and Dreamweaver to present that information on your pages. So there will be a number of times later in this series where we set type_id to 1 or 2 to distinguish between our agents and models, and that's all because this part of the database is setup with 1 or 2 instead of the words agent or model. Notice that null is here for last name for all of our models, that's because they only have first name, but our agents do have first and last names. The other thing I want you to notice is that fields like jump_height and jump_style are null for the agents because they are not ranked by jump_height and jump_style. So not all of the fields in this database are filled in, it depends on what kind of staff member you are. For example, only the agents have Username and Password fields, and as you will see in the administrative section, only agents are allowed to login and make changes to the site, and as you will see when we setup the administration pages later in the chapter, we are only going to allow agents to login and make changes to this site. The only other thing I want to point out here is that if you look at the staff_photos table; and again, dragging that up and choosing Execute will let me display the staff photos table, I want you to see that we don't actually have photographs in this database, we just have the names of each of the photos. So we have small_photo, medium_photo, and large_photo stored here, but we just have the image name. That's why later we will have to bind those image names to an image source tag for those images to display in our web pages. Now, there is so much more to database development than I can possibly get into in this series, but I wanted you to at least have a sense of how this database is structured, that there are multiple tables and that all of the staff are listed in this one staff table, so that as we go though the rest of the lessons, you will have a sense of how the data is structured as we move it into the database. Now, the more time you spend getting to know your database and the more time you think through how you want to structure that data in your website, the better the development of your site will go. Taking the time to do some planning and working with your database programmers before you start building the pages of your site can go a long way toward making sure that the structure of your site is as efficient as possible and as intuitive as possible to navigate. Now that you have a flavor for what's in our database, and you have all of the software that you will need in this series installed properly, you are ready to move on to actually start building the site in the next chapter.