home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows the use of QueryNew --->
-
- <HTML>
-
- <HEAD>
- <TITLE>
- QueryNew Example
- </TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <H3>QueryNew Example</H3>
-
- <P>We will construct a new query with two rows:
- <!--- make a new query --->
- <CFSET myQuery = QueryNew("name, address, phone")>
- <!--- make some rows in the query --->
- <CFSET newRow = QueryAddRow(MyQuery, 2)>
-
- <!--- set the cells in the query --->
- <CFSET temp = QuerySetCell(myQuery, "name", "Fred", 1)>
- <CFSET temp = QuerySetCell(myQuery, "address", "9 Any Lane", 1)>
- <CFSET temp = QuerySetCell(myQuery, "phone", "555-1212", 1)>
-
- <CFSET temp = QuerySetCell(myQuery, "name", "Jane", 2)>
- <CFSET temp = QuerySetCell(myQuery, "address", "14 My Street", 2)>
- <CFSET temp = QuerySetCell(myQuery, "phone", "588-1444", 2)>
-
-
- <!--- output the query --->
- <CFOUTPUT query="myQuery">
- <PRE>#name# #address# #phone#</PRE>
- </CFOUTPUT>
- To get any item in the query, we can output it individually
- <CFOUTPUT>
- <P>Jane's phone number: #MyQuery.phone[2]#
- </CFOUTPUT>
- </BODY>
-
- </HTML>
-