Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Clumsy Hamster #1
Feed query an Array
I grab some stuff out of a URL and pass it to a system query. I then use the
system query to get all the column names for a particular table. I then store
all these into an array. I then want to use the array to grab the field
information from the table I get the column names from. For some reason it
keeps coming back with the array name is not a valid column. Here is the code.
Anyone know why it won't return the values in the fields even though these are
valid column names? Thanks. :confused;
<cfquery name="getDBTablesCResID" datasource="#dbdatalink#"
dbtype="ODBC">SELECT * FROM #getDBName#.dbo.syscolumns where id = (SELECT id
FROM #getDBName#.dbo.sysobjects where xtype = 'U' and name = '#getTBName#')
order by colid ASC</cfquery>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="intLink"><cfoutput>#getDBName#: #getTBName#</cfoutput></td>
</tr>
</table>
<cfset columnName = ArrayNew(1)>
<cfset i=1>
<table border="0" cellpadding="0" cellspacing="0" id="areas">
<tr>
<cfoutput query="getDBTablesCResID">
<td id="areaHeader">#name#</td>
<cfset columnName[i] = #name#>
<cfset i = i +1>
</cfoutput>
</tr>
<cfquery name="getRecords" datasource="#datalink#" dbtype="ODBC">select *
from #getTBName#</cfquery>
<cfoutput query="getRecords">
<tr id="#iif(currentRow Mod 2, DE ('odd'),DE('even'))#">
<cfloop index="i" from="1" to="#ArrayLen(columnName)#">
<td id="areaHeader">#columnName[i]#</td>
</cfloop>
</tr>
</cfoutput>
</table>
Clumsy Hamster Guest
-
Sort array from a Query
I have 2 tables (simplified): coasters (COASTER_CODE, BREWERY_CODE, etc) breweries (BREWERY_CODE, BREWERY) For each brewery I want to count... -
Query+Array
Is there any way to store query resultS into an array so we could loop through it one by one. -
Query Stored In array
Hello, How can store queried data in to two dimenensional array. plz syntax. Thanks in advance Mike -
RSS Feed query
hi Every one, What is RSS feed? can i Create my own RSS feed to that Flash can load the news bit form the one I create or Do I have to use some RSS... -
[newbie] Array and query
Hi to all! :) This week i begin to learn php, but now i have a problem... I made a form in which there is the possibility of choosing some...



Reply With Quote

