• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

If statements and cfquery

Community Beginner ,
Jun 27, 2006 Jun 27, 2006

Copy link to clipboard

Copied

Everyone,

Here is what I would like to do. I am in the process of building a calendar application. I know there are some commercial ones available but I would like to try to solve this on my own before I go that route. I have my calendar in html and to get the event days to match up with the calendar days this is what I am thinking. Preform a query on the database that returns all the records in DB between the first and the last day of the month. I would then write in each <td> an if statement that looks to see if the date has an event associated with it and if so set what I would like displayed as a variable and then display the variables. If not set the variables to blank. My questions is can I do it this way by running the results from the query against if statements. I tried it and I was able to get it to work for just one date but not for the other date. I do not have the page code in front of me, I will post that tomorrow. Any help with this will be greatly appreciated.

Thanks in advance.

Daniel Krajc
TOPICS
Advanced techniques

Views

398

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 28, 2006 Jun 28, 2006

Copy link to clipboard

Copied

You may want to look at doing a query of queries technique. Check the documentation on CFQUERY for the dbtype="query" the syntax is something like:
<cfquery name="qAllEvents">
SELECT * FROM Events
</cfquery>
.....
<td>
<cfquery name="qJustTodaysEvents" dbtype="query">
SELECT * FROM qAllEvents
WHERE date = #dtThisDate#
</cfquery>
<cfif qJustTodaysEvents.recordcount>display events</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2006 Jun 28, 2006

Copy link to clipboard

Copied

Here is the code for the page.

Steve, I will take a look at your ideas later on today and will let you know how I do.

Thanks for the help.

Daniel Krajc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 30, 2006 Jun 30, 2006

Copy link to clipboard

Copied

LATEST
Dear Steve,

The query of the query worked perfectly.

Thanks for the help.

Daniel Krajc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation