SELECT s.StateAbbrev, ac.State, ac.ID, ac.FacilityName, ac.Address, ac.PostCode, ac.PhoneNo, ac.Suburb, ac.WebSite_SearchImage, ac.High_Residential_Care_Booked_Respite_Program, ac.High_Residential_Care_Total_No_Beds, ac.High_Residential_Care_Couples_Accommodation, ac.WebSite_CompanyLogo FROM States s, Aged_Care_Facility_Details ac WHERE s.StateAbbrev = ac.State AND ac.FacilityName LIKE '#keyword#' AND ac.High_Residential_Care_Total_No_Beds <> 0   #Address#
#GetSals.Suburb#
#GetSals.State# #GetSals.PostCode#
#PhoneNo#
Respite Program
Residential Care Beds #GetSals.High_Residential_Care_Total_No_Beds# Couples Accommodation [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => macca2727 [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Session Variable - Coldfusion - Advanced Techniques

Session Variable - Coldfusion - Advanced Techniques

Hi i am using a session variable, but for some reason my results do not show on the page, i havnt used sessions before could you have a look at my code and see what i am doing wrong Many thanks Craig <cfif isdefined('form.keyword')> <cfset session.formvar = #keyword#> </cfif> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1"></head> <body bgcolor="#000000"> <cfparam name = "MaxRows" default = "10"> <cfparam name = "StartRow" default = "1"> <!--- master query: retrieve all info from Employee table ---> <cfquery name = "GetSals" datasource = "exampleapps2"> SELECT s.StateAbbrev, ac.State, ac.ID, ac.FacilityName, ac.Address, ac.PostCode, ac.PhoneNo, ac.Suburb, ac.WebSite_SearchImage, ac.High_Residential_Care_Booked_Respite_Program, ...

  1. #1

    Default Session Variable

    Hi i am using a session variable, but for some reason my results do not show on
    the page, i havnt used sessions before

    could you have a look at my code and see what i am doing wrong

    Many thanks
    Craig

    <cfif isdefined('form.keyword')>
    <cfset session.formvar = #keyword#>
    </cfif>

    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1"></head>
    <body bgcolor="#000000">
    <cfparam name = "MaxRows" default = "10">
    <cfparam name = "StartRow" default = "1">

    <!--- master query: retrieve all info from Employee table --->
    <cfquery name = "GetSals" datasource = "exampleapps2">
    SELECT s.StateAbbrev, ac.State, ac.ID, ac.FacilityName, ac.Address,
    ac.PostCode, ac.PhoneNo, ac.Suburb, ac.WebSite_SearchImage,
    ac.High_Residential_Care_Booked_Respite_Program,
    ac.High_Residential_Care_Total_No_Beds,
    ac.High_Residential_Care_Couples_Accommodation, ac.WebSite_CompanyLogo
    FROM States s, Aged_Care_Facility_Details ac
    WHERE s.StateAbbrev = ac.State AND
    ac.FacilityName LIKE '#keyword#' AND
    ac.High_Residential_Care_Total_No_Beds <> 0
    </cfquery>


    <cfif len(GetSals.WebSite_SearchImage)>
    <img src= CompanyImages/#GetSals.WebSite_SearchImage# width="100" height="100">
    </cfif>&nbsp;</td>
    <td width="156" valign = top><font size = "2" face="Arial, Helvetica,
    sans-serif">#Address#<br>
    #GetSals.Suburb#<br>
    #GetSals.State# #GetSals.PostCode#<br>
    #PhoneNo#</font> </td>
    <td width="253" valign = top>

    <cfif (GetSals.High_Residential_Care_Booked_Respite_Prog ram)>
    <font size="1" face="Arial, Helvetica, sans-serif">Respite Program</font>

    </cfif><br>

    <cfif (GetSals.High_Residential_Care_Total_No_Beds) >
    <font size="1">Residential Care Beds
    #GetSals.High_Residential_Care_Total_No_Beds#</font>
    </cfif>

    <cfif (GetSals.High_Residential_Care_Couples_Accommodati on)>
    <font size="1">Couples Accommodation</font><font size="1"></font>
    </cfif>

    macca2727 Guest

  2. #2

    Default Re: Session Variable

    Since you asked what you are doing wrong.

    <cfif isdefined('form.keyword')>
    <cfset session.formvar = #keyword#>
    </cfif>
    Question - what if form.keyword is not defined. Also, although that code will
    work, you don't need the octothorps inside a cfset tag and you should scope the
    keyword variable.

    Next, once you set your session.formvar (maybe), I don't see you attempting to
    use it anywhere. Therefore you don't know if it has been defined.



    Originally posted by: macca2727
    Hi i am using a session variable, but for some reason my results do not show
    on the page, i havnt used sessions before

    could you have a look at my code and see what i am doing wrong

    Next, you have this:
    ac.FacilityName LIKE '#keyword#'

    Two problems. One, is that keyword may be an empty string, since it appears
    to come from an optional form field. The next is that you use the like keyword
    with no wildcards. That equates to saying ac.FacilityName = '#keyword#' . If
    that's what you want, code it that way, it is more clear and will run faster.

    That should get you started.




    Many thanks
    Craig



    Dan Guest

  3. #3

    Default Re: Session Variable

    ok i have used a template, i can search my column if i type the exact name in
    the search field, but i need to be able to type the first few letters and it
    still picks up the records i have used the following code but i get the
    following error


    The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.
    Null Pointers are another name for undefined values.


    The error occurred in C:\CFusionMX7\wwwroot\CFIDE\DPSGuideWeb\All
    Files\WebSite\Files\test_action.cfm: line 15

    13 : SELECT *
    14 : FROM qEmployees
    15 : WHERE FacilityName LIKE '%#session.formvar#%'
    16 : </cfquery>
    17 :

    any ideas
    Craig

    <cfparam name="StartRow" default=1>
    <cfparam name="DispRows" default=2>

    <cfif isdefined('form.txtKeyword')>
    <cfset session.formvar=#form.txtKeyword#>
    </cfif>

    <cfquery name="qEmployees" datasource="exampleapps2">
    SELECT *
    FROM Aged_Care_Facility_Details</cfquery>

    <cfquery name="qEmployees2" dbtype="query">
    SELECT *
    FROM qEmployees
    WHERE FacilityName LIKE '%#session.formvar#%'
    </cfquery>

    macca2727 Guest

  4. #4

    Default Re: Session Variable

    Have you enabled session variables in your application.cfm

    ShapeShift Guest

  5. #5

    Default Re: Session Variable

    Same as my earlier answer. What is the value of form.txtkeyword when this
    happens?

    Originally posted by: macca2727
    ok i have used a template, i can search my column if i type the exact name in
    the search field, but i need to be able to type the first few letters and it
    still picks up the records i have used the following code but i get the
    following error


    The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.
    Null Pointers are another name for undefined values.


    The error occurred in C:\CFusionMX7\wwwroot\CFIDE\DPSGuideWeb\All
    Files\WebSite\Files\test_action.cfm: line 15

    13 : SELECT *
    14 : FROM qEmployees
    15 : WHERE FacilityName LIKE '%#session.formvar#%'
    16 : </cfquery>
    17 :

    any ideas
    Craig



    Dan Guest

  6. #6

    Default Re: Session Variable

    ok i have worked out what was wrong, in my column that i am querying i have a
    field that is empty, and i need a few fields empty, so is there a piece of code
    that can search a column with a few fields that are empty?

    instead of this WHERE title LIKE '%#session.formvar#%
    Many thanks
    Craig

    macca2727 Guest

Similar Threads

  1. #39634 [NEW]: session variable and normal variable
    By erhanbaris at gmail dot com in forum PHP Bugs
    Replies: 3
    Last Post: November 27th, 10:09 AM
  2. Session Variable in IIS 5
    By Sarevalo in forum ASP Components
    Replies: 3
    Last Post: January 22nd, 07:39 AM
  3. Replies: 1
    Last Post: July 17th, 01:35 AM
  4. [SESSION] Session variable deleted prior to command?
    By Ivo Fokkema in forum PHP Development
    Replies: 0
    Last Post: July 16th, 12:59 PM
  5. Session Variable help please
    By stewboy webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 2
    Last Post: July 16th, 01:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139