Help with QueryNew
Hi,
I have this code:
<cfset mySites = QueryNew("ID, Nombre", "CF_SQL_VARCHAR, CF_SQL_VARCHAR")>
<cfloop from="1" to="3" index="x">
<cfset QueryAddRow(mySites, 1)>
<cfset QuerySetCell(mySites, "ID", "myID" & x , x)>
<cfset QuerySetCell(mySites, "Nombre", "Name 001" , x)>
</cfloop>
<cfloop from="1" to="6" index="x">
<cfset QueryAddRow(mySites, 1)>
<cfset QuerySetCell(mySites, "ID", "myID" & x , x)>
<cfset QuerySetCell(mySites, "Nombre", "Name 002" , x)>
</cfloop>
<cfquery name="getResult" dbtype="query">
select * from mySites
order by ID
</cfquery>
<cfdump var="#getResult#" />
I want to put the result of two loops into one query. This is the result:
| query | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RESULTSET |
| |||||||||||||||||||||||||||||||||
| CACHED | false | |||||||||||||||||||||||||||||||||
| EXECUTIONTIME | 2 | |||||||||||||||||||||||||||||||||
| SQL | select * from mySites order by ID | |||||||||||||||||||||||||||||||||
Why the first 3 rows are empty?
Am I missing something?
Thanks for your help!
Best,
