Creating Data-Driven Pages / Debugging Queries
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
What we're going to take a look at now is Debugging and to give you some assistance while you're developing your pages with Debugging and we haven't looked at that but there is an area in the ColdFusion Administrator where you can turn this on so that when you preview a page in the browser if there are issues you have the Debugging information from ColdFusion right there. In the Debugging area these are the different types of variables that can show up in the lower area of the page and I'll show you that in just a minute. But local variables do not show up in Debugging, so the CFDUMP Tag, if you have watched the CFDUMP movie, is a good way to work with a few things in terms of debugging, but I want to show you this other method. So we're going to go out to the ColdFusion Administrator and I have that open right here and in the Administrator and I'm simply clicked on this top portion here, you don't have to worry about being exactly where I am, what we're going to do is open up the Debugging and Logging area and click on Debug Output Settings and all we need to do is check this right here. Now I also like to turn on the additional information, not really necessary but it does give you additional information as you get into more complicated code you'll want to see as much debugging information as you can. So, I'm going to set both of those and click Submit Changes. I got the green light so I know that worked. So I can get rid of this Administrator, I'll close that up and we'll go back to Dreamweaver. Now what I'm going to do is create a query down in this section and we'll take a look at it in the Debugging area, so I'm going to go into Code view and create a query. I'll give it a name of qTours, so this is not much different than what we've done already. Datasource will be suma and my closing query tag. Notice I'm not using the Recordset Builder and I'm going to say: SELECT all FROM Tours and that's all I will do. So we just want to get a query running, so I'll save this page here and let's put it in the browser now that Debugging has been turned on and you can see, here's my page. Down in this area I have Debugging Information. Now I created the query but I didn't display it on the page, which is why you're not seeing it. If I scroll down here you can see it shows me information about the type of Server, the Template, Time Stamps - all kinds of things. But what I'm going to do here is show you the Execution Time. Now this is the Execution Time for the entire page, not just the query. This is the Execution Time for the query itself, Datasource, number of records returned - as long as I can see the query here I know the query ran without a problem. This area in here, let me explain this red before we look at the Variables down below. If your query, or if your page I should say, not your query, if your entire page takes more than 250 milliseconds to run in terms of execution time these numbers will show up in red, so that's all it's showing you. It's just ColdFusion giving you a hint, you know what, this page took a little longer. You don't have to necessarily do anything with that information, it's just ColdFusion letting you know. As long as your queries can run you will see information about them right here. Now if I scroll down the page you will also see there's quite a bit of information inside this area and these are those different Variables I was mentioning, so this is the CGI Variables section. I have no URL or FORM Variables, or APPLICATION or SESSION or anything else, so all it's showing me is the CGI. So, we'll scroll up, let's actually display the query on the page and let me show you a quick and easy way to display your query using Dreamweaver and I've kind of not used this up until now purposely so that we had to type out our code, but we'll do it real quick. I'm going to open up the Insert Bar by going to Window, Insert. I'm going to go over to the CFML tag and I'm going to click on the word out. We have been using this but not for a query and I'm going to type in qTours because that's my query. I will click OK. I'm not going to do anything else. It does put it wherever my cursor was at the time. You can see it was not where I want it to be so I will mov it down here. I'll also put some words on the page, The qTours Query. I will highlight that and give it a heading 2. Just hit Ctrl-2 once you have it selected and that makes it a heading 2 and let's go take a look. Now here's my query. It looks like it ran. Populated it just fine, but it isn't displaying on the page. Let's go see what's going on; cfoutput query qTours but I'm not printing any information out from my query, so how about we do that. So I'm going to say qTours.tourName so you can see what I'm talking about. Shift-Enter and let's do qTours.tourDescription and I'll add a break there. So even though we used cfoutput sent to query all the tours we didn't have any information on the page itself, so it's helpful to drop on the info. So here is my qTours query and let me make the first line, let me just bold this line, Ctrl-B or Apple-B and we'll go out and here it is. There's our Tours Query on the page. I know it ran, obviously, because it was displayed but there are times when you want to test a query before you go to display it on the page and turning on Debugging assists you with that. So that is Debugging in ColdFusion. You set it up in the Administrator, you would never want to have it on, obviously, on a production server, this is purely for development to help you figure out if there are any errors. Now let me do one last thing before I let you go and that is let's make a mistake in our query so you can see Debugging. And here's our information. This is our basic information and it's trying to show you the query but it can't run because I misspelled tours. So if I scroll down in my Debugging area you can see all it's doing is passing an error, but at least it's telling me which line that error is on and I said additional information, so that is what's happening here and I can try and Debug from here. So, I'll close that up, let me fix this by adding the u. That is Debugging and turning on Debugging in ColdFusion.
Tutorial Information
| Course: | Adobe ColdFusion 8 |
| Author: | Candyce Mairs |
| SKU: | 34093 |
| ISBN: | 1-936334-05-4 |
| Release Date: | 2010-02-26 |
| Duration: | 8 hrs / 112 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 