Querynew - MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference

Cfml language reference
Table of Contents

Advertisement

484

QueryNew

Returns an empty query with a set of columns or an empty query with no columns. See
Usage for more information.
See also QueryAddColumn,
Syntax
QueryNew( columnlist )
columnlist
Comma-separated list of columns you want to add to the new query or an empty
string.
Usage
If you specify an empty string, you can add a new column to the query and populate its
rows with the contents of a one-dimensional array using QueryAddColumn.
Example
<!--- This example shows the use of QueryNew --->
<HTML>
<HEAD>
<TITLE>
QueryNew Example
</TITLE>
</HEAD>
<BODY>
<H3>QueryNew Example</H3>
<P>We will construct a new query with two rows:
<CFSET myQuery = QueryNew("name, address, phone")>
<!--- make some rows in the query --->
<CFSET newRow
<!--- 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>
QueryAddRow
= QueryAddRow(MyQuery, 2)>
CFML Language Reference
and QuerySetCell.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents