Solved

cfquery, columnList results display twice

Posted on 2011-03-16
11
530 Views
Last Modified: 2012-06-27

i'm using this query to pull column names:

SELECT *
FROM ProdFields
WHERE 1 = 2

i'm using this to output the results:

<cfset ColList = listChangeDelims(valueList(GetCurrentProdFieldNames.columnList),",</br>")>
<cfoutput>#ColList#</cfoutput>

the table that i'm querying only has two columns currently but i view the output i see them duplicated like so:

AUTOID
PRODNAME
AUTOID
PRODNAME


any ideas why?

0
Comment
Question by:bede123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
11 Comments
 
LVL 1

Author Comment

by:bede123
ID: 35150662
just an update to this problem. it seems to repeat itself depending on how many colums there are.
i.e. i now have 5 columns so the output block repeats 5 times.
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 167 total points
ID: 35150706

I am guessing you have two sets of CFOUTPUT tags, you cannot nest them unless you are grouping

Try removing the cfoutput tags

<cfset ColList = listChangeDelims(valueList(GetCurrentProdFieldNames.columnList),",</br>")>

#ColList#


0
 
LVL 1

Author Comment

by:bede123
ID: 35150853
yeah i tried that first off. but the output is just:

#ColList# and not data
0
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 39

Expert Comment

by:gdemaria
ID: 35150940
Please show your block of code all around this item..
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 333 total points
ID: 35150990
<cfset ColList = listChangeDelims(valueList(GetCurrentProdFieldNames.columnList),",</br>")>
<cfoutput>#ColList#</cfoutput>

Why are you using valueList? ColumnList returns the names of the columns in the query. So you normally use it *instead* of valueList.  ValueList() is for when you want to generate a list of values in the query.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 35151022
To show the column names, try

<cfset ColList = listChangeDelims(GetCurrentProdFieldNames.columnList,</br>)>
<cfoutput>#ColList#</cfoutput>
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 333 total points
ID: 35151037
With quotes obviously :)

<cfset ColList = listChangeDelims(GetCurrentProdFieldNames.columnList, ",</br>")>
<cfoutput>#ColList#</cfoutput>
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35151052

oh crap, of course... you are trying to show the list of column names...

Good catch agx


I couldn't see the forest through all the trees
0
 
LVL 52

Expert Comment

by:_agx_
ID: 35151148
That was me yesterday :) Tag, you're it.
0
 
LVL 1

Author Comment

by:bede123
ID: 35151800
LOL

sorry for slow reply. had to travel home.

thanks for you input peeps.

agx was right, didnt need the value list in there. seems to be working great!

many thanks
zac
0
 
LVL 1

Author Closing Comment

by:bede123
ID: 35151819
sorry for planting so many trees! :-)
0

Featured Post

Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question