Viewers: in countries Watching now:
An important but little-understood concept in dynamic web development is that of role-based logins, which allow different types of users to access different parts of the site. In this course Adobe Certified Expert Candyce Mairs shows how to use Dreamweaver's features to create role-based logins, restrict page access, build an administrator area, and test everything to make sure it works. Plus, see how to set up a development environment and work with a database from within Dreamweaver. Along the way, build your skills in areas like working with PHP, adding form validation, using server behaviors, and much more.
We are now going to take a look at how to pull data from a database and populate our webpages with that data. Make sure that within XAMPP or MAMP your web server specifically and your database are turned on. We also need to make sure you have a connection setup to the database so you are able to view your database data from within Dream Weaver. If you do not have a connections folder. With comelogin.php inside of it.
You will want to go out and make sure you've done a complete setup for this course and created that data base connection file. We're going to create a new PHP page and I will save this. We'll do a save as Add data. So it's a brand new PHP page called Add data and what we want to do is get some of our database data on to our page over here.
Now within our database we have a table called Tours, and I know you are not familiar with the database at this point. So lets take a look at the Tours table. In order to do that I can right-click the table name and go down to View data. And this is a listing of all of the various tourists that Scuba to you arranges for clients. So there are quite a few tourists available here. Here's the Tour name, a description of the Tour. Here we are the number of days of the Tour, the number of diving days within that Tour, costs, whether meals are included or not. And also, if it's a Liveaboard or not.
And we're storing the data for Liveaboard as true false values. Either true it's a Liveaboard, or false it's not. And that was done when the database was created. We're not going to be concerned about that piece right now. What we want is to get a nice listing of all of our Tours onto our web page. So, how we go about doing that? We have 25 Tours listed within this interface at any given time. So here is our 25 Tours.
I can see the remainder of the Tours if I click next. So there is a total of 27 Tours our company offers. It's good to know that number to make sure that you double-check once you pull the data onto the page and make sure it does match the actual data in your database. So there were 27 Tours, so I'm going to type Tours. I'm going to use Ctrl+1 or Cmd+1, in order to make that a header, just so it's easier to see the page. And then hit Enter or Return.
So I can put my cursor anywhere in this first line. And hit Ctrl or Cmd+1. That's makes it a header one and then just hit Return or Enter. This is where we're going to list our Tours on the page. How do we pull data out of a database, well we need to go over, not to the databases tab, because all that does is show us the information in the database. It does not allow us to pull it out. What we want is the bindings tabs right next door to that.
If for some reason your binding tabs is not showing, you can always access it by going to Window Bindings. Also you want to make sure that all three are checked. In case they are not within this area, you will want to go back to the data bases tab and make sure you can get your tables properly set up. I would suggest you go back through the installing course files and also setting up the database to make sure that Dreamweaver understands the databases and sets up a connections folder for you.
Now within the Bindings tab, I'm going to hit the Plus sign, and I'm going to choose Record Set. Now within this Record Set area, we need to give our query a name, so I'm going to put the letter Q, meaning it's a query, and use the word Tours, because that's the information we are pulling out of the database. We only have one connection to find. This is that connection that's being stored in our connections folder. Once we make the connections to the database, we have access to all of the tables within the database.
So I'm going to choose the Tours table. Now, at this point, you may be in an advanced interface, a slightly different looking Record set area. So, let me show you going back and forth at this point, if I click this advanced button, I move into a different looking Record Set builder, and this is known as the Advanced view. But what I like about this view, even if you're not doing a table join, and I'll mention that in a minute.
Even if you're not doing that It gives you a chance to easily see the sequel that Dreamweaver is creating for you. Now this is a very simple sequel statement. A select statement postdata out of the database. You can build your record set in the simple interface. If I click this button, it takes me back to that interface or I could also build my select statement down in this area. I'm not going to cover doing it this way.
At this point, this is a simple sequel statement. So I'm going to click the simple button. I think when you're just starting out it's much easier to use this interface, as long as it's only one table you're compiling data from this interface is much easier. Now we have to decide what data we want pull out of the database. And what I'm going to do is click on selected. If I'm in all, everything's great out. The assumption is you want to pull all of the data out of the database. We don't need all of it, we just want to limit it to exactly what we want. So, I will pull out just Tour name.
I'm not going to filter in anyway. So I won't talk about this piece but I am going to sort. I want the data base to return this information based on Tour name, alphabetical order, beginning with A. So if I click the test button. Here is the information that's returned. Nice and neatly returned in alphabetical order. So I'll click okay. It's a good idea to test your queries.
As soon as a I click okay, I now have access to that record set from within the Bindings panel. And right after the word record set is Q Tours. That's the name of my Tour. In order to work with this I can drag it out onto the page from this panel. So I now have my Tours populating the page. Now if I click the Live View button or if you do not have the Live View button in your version of Dreamweaver. Click on this and preview in the full browser.
I'll click on live view and you can see, I definitely have a single Tour put onto the page, not 27. So we will need to add something in order to get all of the Tours printed onto our page. And we'll need to take a look at how to do that. We're going to let Dreamweaver help us through that process.
There are currently no FAQs about Dynamic Dreamweaver Websites: Creating Login Areas.
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.