Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 135
  • Last Modified:

Outing putting a fieldname called 1?

I have a field name called 1(one) from a table called users.  It is a number.  When I output it, it generates an error.  Is there a way round this?

Code :

<cfquery name="test" datasource="test">
select 1
from users
</cfquery>

*<cfoutput query="test">#1#</cfoutput>???

This part with the asterix(*) generates an error.

0
nashbubble
Asked:
nashbubble
1 Solution
 
PatrikMuellerCommented:
Hi,

in the SQL command "select 1 from users" the 1 is interpreted as a value not as a field name.
You have to specify a field name.

Try to use this command:
Select 1 as fieldname from users

<cfOutput query="test">#fieldname#</cfOutput>

Bye
Patrik
0
 
nashbubbleAuthor Commented:
thank you it works just fine
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now