|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Cookies..
How to tell if one is defined or not.. ?
i tried <cfif #cookie.x# is ''> but no go.. how would you do that? Also i have a field in my database that has numbers in it like: 43,35 how could i take one of the numbers and set it as a cookie, and put the other as another? ie: #cookie.x# as 43, and #cookie.y# as 35.. |
|
#2
|
|||
|
|||
|
<cfif not structKeyExists( cookie, 'myKey' )>
<cfset cookie.myKey = "whatever"> </cfif>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Thanks
Quote:
How am I going to have to do the last part of it? Or should I just use two different fields for the two? |
|
#4
|
|||
|
|||
|
Yes just set two cookie values. cookie.a = "blah" cookie.b = "foo"
Remember that there are limits to how many cookies you can store as well as the size of the cookies. Don't rely on cookies to store many values or any values of large size. |
|
#5
|
||||
|
||||
|
I honestly didnt read the whole thread so if this makes no sence "my bad"
Code:
<CFIF IsDefined("COOKIE.mycookie")
do whatever
</CFIF>
the opposite also works
<CFIF not IsDefined("COOKIE.mycookie")
do whatever
</CFIF>
-Alas |
|
#6
|
|||
|
|||
|
Ok i'm new.. so please someone tell me why this isn't working.
![]() <CFIF NOT structKeyExists(cookie, "x")> <cfquery name="get_x" datasource="aeris7282"> Select x from map where user_id = '#session.user_ID#' </cfquery> <cfoutput query="get_x> <cfcookie name="x" value="#x#"> </cfoutput> </CFIF> |
|
#7
|
|||
|
|||
|
Post the error. The code doesn't help at all if you don't explain what is happening.
|
|
#8
|
|||
|
|||
|
There isnt one. Just nothing is happening..
Quote:
|
|
#9
|
|||
|
|||
|
You might try:
<CFIF NOT isDefined( 'cookie.x' )> ... </cfif> Can't remember, but cookie might not be treated as a struct. |
|
#10
|
|||
|
|||
|
oh wow im embaressed, i forgot an end quote.
![]() Quote:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Cookies.. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|