Link to home
Start Free TrialLog in
Avatar of Zac123
Zac123Flag for United Kingdom of Great Britain and Northern Ireland

asked on

query_name.columnList - display vertically?

hi all,

is it possible to force a br tag after each comma in a query_name.columnList?

i can give more info if needed

z

ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zac123

ASKER

many thanks. i can get both to work but it seems there might be an issue with the way i'm querying for the column names because they seem to be repeated twice:

SELECT *
FROM ProdFields
LIMIT 1

results in:

AUTOID,
PRODNAME,
AUTOID,
PRODNAME

you see how this table only has two colums but its repeated twice.

before using the SELECT *

i was using:

SHOW COLUMNS

Butr that gave me:

EXTRA
FIELD
TYPE
NULL
KEY
DEFAULT
EXTRA

which is not what i'm after as its not actually the column names.....
If you are after the column names, you should be able to grab them after a CFQUERY.  It doesn't matter how many records are returned 0, 1, or many

<cfquery name="myQuery" datasource="...">
  SELECT * FROM ProdFields
</cfquery>

<cfoutput>#myQuery.columList#</cfoutput>

If you're doing much more than that, perhaps there is a problem with the specific code; if so, please post the code..  Thanks
Avatar of Zac123

ASKER

Yes that exactly what i was doing BUT from looking at the cfdump info i realised that by doing:

SELECT *

i was querying the db for everything in the table, and the plan is for this table to be big!

so i added:

LIMIT 1

but apart from that my code is the same as yours. even if i take the LIMIT 1 out it still returns the whole thing twice:

AUTOID
PRODNAME
AUTOID
PRODNAME




however i'm going to close the question and award the points because the original question has been answered. i will post back with a new question after i have done some googling.

many thanks again

gdemaria.


z
> i was querying the db for everything in the table, and the plan is for this table to be big!

you can also not return any rows, so this will work as well..

 SELECT * FROM TABLE WHERE 1 = 2

that will not return any rows, but will give you your column names

In your new question, please post some code, the problem is probably specific to your code as you have the right approach