1 Reply Latest reply on Jun 21, 2006 4:33 AM by jdeline

    cselse

    RyanG24 Level 1
      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>
        • 1. cselse
          jdeline Level 1
          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.