Skip to main content
Participant
April 17, 2007
Question

query output skipping every other row

  • April 17, 2007
  • 3 replies
  • 469 views
I am using Coldfusion MX 7.0.1, and have two applications using the same datasource. In one, a SELECT query followed by a cfoutput lists all rows properly, but the following code (in the other app) only lists every other row of the query result set, for some reason:

<cfselect name="Record_Group" multiple="no" size="4"
required="yes" message="Select a Record Group...">
<cfoutput query="RecordGroupQ">
<cfif compare(#RecordGroupQ.RecordNum#,#Edit_origQ.acc_num#) eq 0>
<option value="#RecordGroupQ.RecordNum#" selected>#RecordGroupQ.RecordNum#</option>
<cfelse>
<option value="#RecordGroupQ.RecordNum#">#RecordGroupQ.RecordNum#</option>
</cfif>
</cfoutput>
</cfselect>

The query is in the <head>, and is:

<cfquery name="RecordGroupQ" datasource="arch_card">
SELECT RecordNum FROM RecordGroups ORDER BY RecordNum ASC;
</cfquery>

Has anyone seen anything like this before?

Thanks,
Jason
This topic has been closed for replies.

3 replies

Inspiring
April 18, 2007
With some db's, oracle for example, the query will crash.
cazzersonAuthor
Participant
April 18, 2007
Thanks for the replies...After seeing a clean cfdump, I looked a little deeper into the page source and realized that it was a problem with how Firefox was interpreting some commented lines I had mistakenly placed within the cfloop. After moving them outside of the loop, and repairing the comment format (<!--- instead of <!--), everything came out well.

Thanks,
Jason
Inspiring
April 18, 2007
Dan Bracuk wrote:
> As an aside, you don't want semi-colons in cfqueries.

that's interesting... why is that so? i have been wondering about
semi-colons lately myself, but could not find a definite
explanation/rule/guide/best practice on whether to use them or not...

could you please explain, Dan?

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Inspiring
April 17, 2007
If you cfdump your query, do you see every record?

As an aside, you don't want semi-colons in cfqueries.