Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6616945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:38:39+00:00 2026-05-25T20:38:39+00:00

Alright SO users… Here’s a seemingly impossible to go wrong conditional statement. It is

  • 0

Alright SO users… Here’s a seemingly impossible to go wrong conditional statement. It is very simple, however, I cannot figure out why it won’t work the way it is expected to.

<cfoutput query="checkForAd">
        <!--- also used the line <cfif RecordCount eq 0> --->
    <cfif checkForAd.RecordCount eq 0>
        <!--- Display some message. (Perhaps using a table, undecided) --->
    <cfelse>
        <!--- Display some other message. (Happens to be a table) --->
    </cfif>
</cfoutput>

When the RecordCount returns a number greater than 0, the else case displays properly. When RecordCount returns 0, nothing is displayed and the form continues along its path. I’ve become very frustrated as this should be quite simple…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:38:40+00:00Added an answer on May 25, 2026 at 8:38 pm

    The output won’t return any results if the query set is empty. Try:

    <cfif checkForAd.RecordCount eq 0>
        <!--- Display some message. (Perhaps using a table, undecided) --->
    <cfelse>
        <cfoutput query="checkForAd">
            <!--- Display some other message. (Happens to be a table) --->
        </cfoutput>
    </cfif>
    

    I assume that you’re looking to return a number of records… if you were just returning one, the query="checkForAd" isn’t necessary. You can simply reference the query & variables in a <cfoutput></cfoutput>.

    Edit

    Here’s one way to access a query variable: QueryName["ColumnName"][RowNum]

    (As you look to expand your coding, there’s a lot you can do with query variables. There’s a great rundown of the different approaches at ColdFusion and getting data from MySQL)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, here goes. I'm making a very basic app, and I want the user
Alright, very noob question. I'm making a CLI app that lets users design surveys.
I have a very simple table structure here. Just a list of words related
This sounds simple, and probably is... Alright, so I have two tables, users and
Alright. So I figure it's about time I get into unit testing, since everyone's
Alright. So I have a very large amount of binary data (let's say, 10GB)
Alright, Here's the gist of what I'm planning to do. I'm going to have
Alright so here it goes, I have my user system working perfectly, and now
Alright so I want my users to be able to click a link that
I have a website, with basic Forms Authentication working alright. Users have emails that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.