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 6370847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:58:58+00:00 2026-05-25T00:58:58+00:00

I have the following ColdFusion code that is getting information from a database and

  • 0

I have the following ColdFusion code that is getting information from a database and displaying the results on the homepage. Here’s the cfquery code:

<cfquery name="getSchedule" datasource="#APPLICATION.datasource#" dbtype="odbc">
SELECT * FROM SCHEDULE_Days SD 
LEFT JOIN SCHEDULE_ScheduledClasses SSC ON SD.day_id = SSC.day_id
LEFT JOIN SCHEDULE_Classes SC ON SSC.class_id = SC.class_id
WHERE SD.day_date = #createODBCDate(now())# AND SSC.schedule_cancelled = 0
ORDER BY SSC.start_time
</cfquery>

and the output code:

<cfoutput>
<cfloop query="getSchedule">
<tr>
<td width="40">&nbsp;</td>
<td width="74">#lcase(timeFormat(start_time,"h:mm tt"))#</td>
<td width="158">#class_name#</td>
</tr>
</cfloop>
</cfoutput>

The issue is, if there is no data contained within getSchedule (i.e., there are no ScheduledClasses), it displays nothing.

I’m looking for a way to change this so that, in the event that there is no data to display, I can specify a message and code to be shown in its absence.

  • 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-25T00:58:59+00:00Added an answer on May 25, 2026 at 12:58 am

    First just a quick CF tip you can make you code better by doing it this way:

    <cfif getSchedule.recordcount GT 0>
        <cfoutput query="getSchedule">
        <tr>
            <td width="40">&nbsp;</td>
            <td width="74">#lcase(timeFormat(getSchedule.start_time,"h:mm tt"))#</td>
            <td width="158">#getSchedule.class_name#</td>
        </tr>
        </cfoutput>
    <cfelse>
        <p>Empty record message here</p>
    </cfif>
    

    The reason I put the query output first is most likely this will happen more than with your empty set message.

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

Sidebar

Related Questions

I have the following ColdFusion 9 code: <cfloop from=1 to=#arrayLen(tagArray)# index=i> <cfquery name=qryGetSPFAQs datasource=#application.datasource#>
I have the following Coldfusion process: My code makes a database call to the
I have the following code that is really bugging me, I'm thinking perhaps the
I have a code that uses Arrays.sort(char[]) in the following manner: void arrayAnalysis(String[] array){
I have a silly confusion here. I have the following main() in my code
I currently have the following code to get a specific value i need from
In ColdFusion version 9, I have the following in Index.cfm: <cfdump var=#Application#> But the
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section
ColdFusion 8 I have a cfgrid that that is based on a query. It

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.