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.

Pulling Values from another Page
So far all of the Recordsets you have created have been run from a static SQL statement. To have the results change would require going in a changing the Recordset every time. This is not hard to do (the editor is easy to use) but you can make SQL work harder for you.

One way to do this is to pass a value from one page to another. For instance; you are building a phone director of all of the users in your company. On the first page you may have a table that lists the letters of the Alphabet. Each letter is a link that sends you to another page. The results on the second page are all of the names that begin with that letter.

For this you will need to use two pages.

Call one page “list.asp” and the second page “details.asp”.

Open “list”. On the page add letters from the alphabet, A-Z. Select the letter “A” and add the following link to it “details.asp?LASTNAME=A”. This is a special type of link. It sends you to the next page, but it also passes a value, in this instance A, to the next page. At this point the trick is to now have “details.asp” pick up use this value.

Open “Details.asp”. You can use the Recordset we created earlier. To do this go to the page you had the rsCompass recordset. Select rsCompass from the Data Bindings panel and right click on it. Choose “copy” from the pop up menu that appears. Now, go to Details.asp. If the Data Binding panel is not open, open it. Right click on the Data Bindings panel and “paste” the Recordset. It has now pasted in all of your values!

Double click on the rsCompass Recordset in details.asp.  The settings will be for the Employee Table from the Compass Travel database. Select the Filter drop down. Choose LASTNAME. Select match symbol to be “Begins with”.  The value with be a “URL Parameter”. By doing this, the link we have from the previous page can match the field LASTNAME with a specified value.

Drag the LASTNAME field onto the page. Save the “details.asp”. Preview list.asp and select the link from A. This will take you to the details.asp page and display only the employees that begin with letter “A”. You can do the same for the other letters in your list.asp page by simple changing the last letter of the link. For instance, the link for the letter “F” will be “details.asp?LASTNAME=F”.

Voila! You will now be worshipped as a God for creating an effective and easy to use company wide online directory. And to think, all you have to do was have UltraDev do all of the heavy work for you. No need to learn SQL to create complex recordsets. Next stop, creating those web pages for the Sales figure the boss asked for.

<< Back to beginning of the article


About 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 and Inside Dreamweaver 4. You can also see him popping up in many online magazines, such as Sitepoint.com, Windowatch.com and UDzone.com.

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.