Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFOUTPUT to One Line w/o the Automatic Carriage Return

Status
Not open for further replies.

DavidC271

Technical User
Jul 30, 2002
17
US
Im trying to output a cfquery to one line so it can be scrolled across a news ticket. My problem is that when I setup my output I get:
Item 1
Item 2
Item 3
Im trying to get:
Item 1 Item 2 Item 3 ...

So far I have gotten CF to output one line but its the first record over and over again... Not sure how that happened. Here is my code

Code:
<cfquery name="rsEvents" datasource="datasource">
SELECT event_dt, event_title
FROM table
</cfquery>

<cfset events = "#rsEvents.event_dt# - #rsEvents.event_title#">

<cfoutput query="rsEvents">#events#</cfoutput>

This outputs the first record, inline, over and over again ending with the total record count of the table...

I sure could use your help,
Thanks in advance...
 
your CFSET is outside your CFOUTPUT loop, so it grabs only the first row

try this --
Code:
<CFQUERY NAME="rsEvents" DATASOURCE="datasource">
  SELECT event_dt
       , event_title
    FROM table
</CFQUERY>

<CFOUTPUT QUERY="rsEvents">#event_dt# - #event_title# ; </CFOUTPUT>
i use a semi-colon so that your evens would have some kind of separator

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
YOU ARE A LIFE SAVER!!!

Dropped the cfset and changed the cfoutput query to what you have it bingo presto...

Thanks again, I have been trying to figure out my mistake for three hours now and was getting very frustrated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top