Here's what I would do:

First of all, check that you actually do have session variables set up.
Make sure you have session variables turned on in your CFAPPLICATION tag.

As a minimum you need:

<cfapplication name="Applicationname" sessionmanagement="yes">



Then in your application.cfm temporarily put a cfdump of the session vars to
see what's in there.

<cfdump var="#session#">

Then you'll see if you have a session.init defined or not.  

You really should use a different test than IsDefined("SESSION.init")
Instead use StructKeyExists

<cfif StructKeyExists(session, "Init")> stuff </cfif>





Cheers,

Michael Kear

Windsor, NSW, Australia

AFP Webworks.





-----Original Message-----
From: Pascal Peters [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 7 October 2003 10:20 PM
To: CF-Talk
Subject: RE: application.cfm

It should work. Are you sure you are executing the right
application.cfm. Try putting some text in there to verify. You should
see the text.

application.cfm
------------------
<h3>Setting session</h3>
<cfif NOT IsDefined("SESSION.init")> ...

-----Original Message-----
From: Bushy [mailto:[EMAIL PROTECTED]
Sent: dinsdag 7 oktober 2003 14:11
To: CF-Talk
Subject: RE: application.cfm

If I put the query and <cfset SESSION variables into my index.cfm file I
can output the results no problem. It won't work if its in my
application.cfm?

Whats wrong?

--Original Message Text---
From: Bushy
Date: Tue, 07 Oct 2003 07:53:15 -0400

Why is this not working?

I have the following code in my application.cfm

application.cfm
------------------

<cfif NOT IsDefined("SESSION.init")>
<cfquery name="listenv" datasource="database">
select *
from table1
where struser = test
</cfquery>

<cfset SESSION.field1 = #listenv.field1#>
<cfset SESSION.field2 = #listenv.field2#>
<cfset SESSION.field3 = #listenv.field3#>
<cfset SESSION.field4 = #listenv.field4#>

<cfset SESSION.init = true>
</cfif>

Then in my index.cfm file I'm just outputting the above SESSION
variables for testing yet gets displayed except the SESSION.init
variable. Why?
What's wrong with my syntax?

index.cfm
------------

<cfoutput>
SESSION.init: #SESSION.init#<br>

SESSION.field1: #SESSION.field1#<br>
SESSION.field2: #SESSION.field2#<br>
SESSION.field3: #SESSION.field3#<br>
SESSION.field4: #SESSION.field4#<br>
</cfoutput>



  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to