Results 1 to 2 of 2
  1. #1
    Abina's Avatar
    Abina is offline Master
    Join Date
    Dec 2009
    Location
    United States
    Posts
    1,073
    Thanks
    1
    Thanked 6 Times in 4 Posts
    Feedback Score
    0

    Default Invalid column name?!

    Hello everyone,
    I'm passing a variable over a URL. The value is user01.

    The problem is that an error message occurs stating that there is an incorrect column name?! Here is the code below and the error message:

    <cfquery name="userQuery" datasource="xxxxx" username="xxxxx" password="xxxxx">
    SELECT admin FROM users WHERE username="#url.promo#"
    </cfquery>

    It comes up with the following error:

    [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'user01'.

    Please help.

    Many thanks in advance,

  2. #2
    numberone's Avatar
    numberone is offline Senior
    Join Date
    Jan 2010
    Posts
    623
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    <cfquery name="userQuery" datasource="xxxxx" username="xxxxx" password="xxxxx">
    SELECT admin
    FROM users
    WHERE username= <cfqueryparam cfsqltype="cf_sql_varchar" value="#url.promo" />
    </cfquery>

    This should help you out. It is good practice to use cfqueryparam to help with SQL injection.

Similar Threads

  1. Frame height problem
    By hilda_mateiu in forum HTML / DHTML
    Replies: 14
    Last Post: 05-16-2012, 03:15 AM
  2. Variable Column Name - MS SQL
    By manik in forum Databases
    Replies: 3
    Last Post: 12-13-2010, 01:05 PM
  3. Released another website
    By logic in forum Reviews
    Replies: 8
    Last Post: 03-03-2010, 11:28 AM
  4. Replies: 1
    Last Post: 01-31-2010, 11:11 AM
  5. Replies: 0
    Last Post: 08-27-2008, 10:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Partners: BOSTON WEB DEVELOPER, LLC   |   WEBCOSMO CLASSIFIEDS