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

cselse

New Here ,
Jun 20, 2006 Jun 20, 2006

Copy link to clipboard

Copied

i have this query below, which works but i need to add a else clause to the SESSION.year5

what i need the esle clause to do is
<CFELSE SESSION.Year5 = MAX GetResults.MR.Season>

not sure how to do this any ideas?

thanks


<cfparam name="SESSION.TeamName5" type="string" default="">
<cfparam name="SESSION.Year5" type="string" default="">

<cfif isdefined ("FORM.TeamName")>
<cfset SESSION.TeamName5 = FORM.TeamName>
<cfelse>
<cfset SESSION.TeamName5 = 1>
</cfif>

<cfif isdefined ("FORM.Years")>
<cfset SESSION.Year5 = FORM.Years>
</cfif>


<cfquery name="GetResults" datasource="Cricket">
SELECT *
FROM matchresults MR

INNER JOIN
TeamNames TN
ON MR.TeamID = TN.ID

INNER JOIN
SeasonTable ST
ON MR.Season = ST.SeasonID

WHERE
0=0
<CFIF SESSION.TeamName5 IS NOT "">
AND
(MR.TeamID = '#SESSION.TeamName5#')</CFIF>
<CFIF SESSION.Year5 IS NOT "">
AND
(MR.Season = '#SESSION.Year5#')</CFIF>
</cfquery>
TOPICS
Advanced techniques

Views

194

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
Guest
Jun 21, 2006 Jun 21, 2006

Copy link to clipboard

Copied

LATEST
If I'm reading you right, the code below should work for you.

Edit: However, after looking at your code again, you cannot set a session variable within a CFQUERY tag. You need to redo your CFIFs
after the CFQUERY and set your session variable if the CFIFs fail.

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