home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / querynew.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.0 KB  |  42 lines

  1. <!--- This example shows the use of QueryNew --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. QueryNew Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BODY>
  12.  
  13. <H3>QueryNew Example</H3>
  14.  
  15. <P>We will construct a new query with two rows:
  16. <!--- make a new query --->
  17. <CFSET myQuery = QueryNew("name, address, phone")>
  18. <!--- make some rows in the query --->
  19. <CFSET newRow  = QueryAddRow(MyQuery, 2)>
  20.  
  21. <!--- set the cells in the query --->
  22. <CFSET temp = QuerySetCell(myQuery, "name", "Fred", 1)>
  23. <CFSET temp = QuerySetCell(myQuery, "address", "9 Any Lane", 1)>
  24. <CFSET temp = QuerySetCell(myQuery, "phone", "555-1212", 1)>
  25.  
  26. <CFSET temp = QuerySetCell(myQuery, "name", "Jane", 2)>
  27. <CFSET temp = QuerySetCell(myQuery, "address", "14 My Street", 2)>
  28. <CFSET temp = QuerySetCell(myQuery, "phone", "588-1444", 2)>
  29.  
  30.  
  31. <!--- output the query --->
  32. <CFOUTPUT query="myQuery">
  33. <PRE>#name#    #address#    #phone#</PRE>
  34. </CFOUTPUT>    
  35. To get any item in the query, we can output it individually
  36. <CFOUTPUT>
  37. <P>Jane's phone number: #MyQuery.phone[2]#
  38. </CFOUTPUT>
  39. </BODY>
  40.  
  41. </HTML>       
  42.