Adobe COLDFUSION 9 Manual page 440

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Accessing and Using Data
<html>
<head>
<title>Images Folder</title>
</head>
<body>
<h2>Image Retrieval with QoQ</h2>
<!--- Set the images directory. --->
<cfset dir = ("C:\pix\")>
<!--- Retrieve all GIFs. --->
<cfdirectory name="GetGIF"
action="list"
directory="#dir#"
filter="*.gif">
<!--- Retrieve all JPGs --->
<cfdirectory name="GetJPG"
action="list"
directory="#dir#"
filter="*.jpg">
<!--- Join the queries with a UNION in a QoQ (cfdirectory
automatically returns the directory name as "Name"). --->
<cfquery dbtype="query" name="GetBoth">
SELECT * FROM GetGIF
UNION
SELECT * FROM GetJPG
ORDER BY Name
</cfquery>
<!--- Display output in a linked, ordered list. --->
<cfoutput>
<p>The <strong>#dir#</strong> directory contains #GetBoth.RecordCount#
images:<br>
<ol>
<cfloop query="GetBoth">
<li><a href="../images/#Name#">#GetBoth.Name#</a><br>
</cfloop>
</ol>
</cfoutput>
</body>
</html>
Save the page as qoq_cfdirectory.cfm in the myapps directory under the web_root.
2
Display qoq_cfdirectory.cfm in your browser.
3
Query of Queries user guide
If you know SQL or have interacted with databases, you might be familiar with some of the Query of Queries
functionality.
Using dot notation
Query of Queries supports using dot notation in table names.
Last updated 8/5/2010
435

Advertisement

Table of Contents
loading

Table of Contents