Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
robstacey #1
Re: CFFILE output multiple rows from a query
I have a quiestion about the below. I am working with this method, but I find
that my code results in the first record being outputed twice in the document.
How can I resolve that? And I can not just leave a blank line at the top (that
will screw things up further into what I am doing).
My code is attached:
<cffile action="WRITE" file="#adrdir#\sfiles.dat" output="#Dirlist.Name#">
<cfloop query="Dirlist">
<cffile action="APPEND" file="#adrDir#\sfiles.dat" output="#Dirlist.Name#">
</cfloop>
robstacey Guest
-
DBI Query rows Benchmark
Hello! I have a questionto those lovers of DBI and Databases: which method is faster to know the number of rows of a query: $sth->rows or ... -
Multiple output from singe search query
I have a search page that searches a database table of technical articles on a computer support site. In the table, there are bit columns for... -
Generating table rows and columns in output?
When I output the query results, I would like to display them in a 4 column table. While I can have it add a column as cell as in... -
Query problem with multiple records output
ABERDEEN, , GB ABERDEEN, MD, US ABERDEEN, MS, US ABERDEEN, NC, US ABERDEEN, SD, US ABERDEEN, WA, US Results as above from a search form... -
CFFILE - Uploading multiple files
I'm having a problem trying to upload several files. I am using the code below. Any assistnace will be appreciated. Thanks Norm <cfdirectory... -
Stressed_Simon #2
Re: CFFILE output multiple rows from a query
Try this!
<cfset FileData = "">
<cfloop query="Dirlist">
<cfset FileData = FileData & Dirlist.Name>
</cfloop>
<cffile action="WRITE" file="#dir#\filenamet" output="#FileData#">
Stressed_Simon Guest
-
robstacey #3
Re: CFFILE output multiple rows from a query
Using this code resulted in only the last record being written to the file.
Anything else?
robstacey Guest
-
Stressed_Simon #4
Re: CFFILE output multiple rows from a query
OK VERY weird?????? Have you tried outputting the variable before the cffile to see if it has added all the data. Also cfdump the query to make sure it has what you think it does in it!
Stressed_Simon Guest
-
efecto747 #5
Re: CFFILE output multiple rows from a query
try adding a carriage return to the loop stressed_simon suggested:
<cfloop query="Dirlist">
<cfset FileData = FileData & Dirlist.Name & Chr(13)>
</cfloop>
efecto747 Guest
-
robstacey #6
Re: CFFILE output multiple rows from a query
Thank to everyone for your help. The resolution was:
<cfset FileData = "">
<cfloop query="query">
<cfset FileData = FileData & query.var & #Chr(13)#&#Chr(10)#>
</cfloop>
<cffile action="WRITE" file="dir\filename" output="#FileData#">
robstacey Guest



Reply With Quote

