Getting the Information You Need

Have you ever had anyone scream at you “I NEED THE SALES FIGURES FOR THE NORTHERN GROUP ON OUR WEB SITE! TODAY!!” Ever had those days? You can put these figures on a web site. But, why not have the web site do it for you with dynamically driven web pages. To be able to access this type of information you need a database. But, more than that, you need to be able to query the content in the database. To do this on a Web page you must be learn how to leverage the Structured Query Language (SQL). Sound hard? Fortunately, Macromedia has come bounding to our rescue with tool designed for these types of crisis: Dreamweaver UltraDev. In this article you will learn how to create SQL usingDreamweaver UltraDev’s easy to use interface.

Creating a Dynamic Web Page
Select FIRSTNAME and LASTNAME fields and drag them onto the page. You should see the highlighted placeholders {rsCompass.FIRSTNAME} and {rsCompass.LASTNAME}. These are visual placeholders for the dynamic content that will be retrieved from the database when you run the page through the web server.  Select the “Enter” key to create a hard return after the two fields. If you have the Site Properties configured correctly you should be able to select “Show Live Data View”  and see the page display the first name from the Employee table in the Compass Travel database, as shown in Figure G.


Figure G: The first FIRSTNAME and LASTNAME are displayed using the Live Data view

Having one record appear on the page is fine, but you will find that more often than not, you will need to display all of the records from the database. To do this you will need to leverage a little UD magic. Click on the page and choose “Ctrl+A” to choose everything on the page. Open the Server Behaviors Panel and choose “Repeat Region” as shown in Figure H.


Figure H: The Server Behavior’s Panel is a collection of Actions that are executed
on the Application Server before being delivered to a Web browser.

The “Repeat Regions” window opens, as shown in Figure I.


Figure I: The Repeat Region Window

You must first choose which recordset will be used to extract data needed for the repeat region. Choose rsCompass from the drop down list (it should be the only one). You can elect how many records at a time will appear on the page. For now, choose “All Records”.  If you still have “Live Data View” turned on you will now see a list of names on the page as shown in Figure J.


Figure J: With Live Data View turned on the list of all people
from the Employee Table is displayed onto the page.

What a great list! By extending the capabilities of the Recordset you can control how the data is presented on the page.

Next: Sorting Wtih SQL >>

Matthew David

Matthew David has been developing Flash based applications for over 6 years (that makes him very old in this business!). Examples of his work can be found at his web site www.matthewdavid.ws, or you can email him directly at mdavid@email.com.

Matthew’s most recent publications include content for Flash 5 Magic, Inside Dreamweaver 4, Flash 5: Visual FX, Web Publishing Bible and The Dreamweaver Bible. You can also see him popping up in many online magazines, such as Sitepoint.com, Windowatch.com, UDzone.com and DevX.com.

Currently, Matthew is working on two books and writing articles for Element K Journal’s Macromedia Solutions magazine. He is a available as a freelance consultant to work on web based projects.

See All Postings From Matthew David >>

Comments

Be the first to write a comment

You must me logged in to write a comment.