SELECT tripID, tripName, tripLocation, departureDate, returnDate, price FROM trips WHERE #PreserveSingleQuotes(WhereClause)# [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => KevCB [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] => ) --> Compass Travel example search not working - Coldfusion Database Access

Compass Travel example search not working - Coldfusion Database Access

Hi I seem to be having a problem copying the example Compass Travel application in the pdf files. When I've copied the code to create the first part of the search with the tripLocation as the WHERE clause in the query. When running the search with selecting the begins with from the select box and using C, it brings back absolutely nothing. Yet if I run the search selecting is and type in China, it brings back the one record like it says in the PDF file. It seems as if the query isn't running the wildcard for the begins ...

  1. #1

    Default Compass Travel example search not working

    Hi

    I seem to be having a problem copying the example Compass Travel application
    in the pdf files.

    When I've copied the code to create the first part of the search with the
    tripLocation as the WHERE clause in the query.
    When running the search with selecting the begins with from the select box and
    using C, it brings back absolutely nothing.
    Yet if I run the search selecting is and type in China, it brings back the one
    record like it says in the PDF file.

    It seems as if the query isn't running the wildcard for the begins with
    search, when running through the examples has anyone encountered this problem,
    or know why this is happening?

    Thanks

    Here's my function in the CFC:


    <cffunction name="getTripsFromForm" output="false" access="public"
    returntype="query">
    <!--- Create WHERE clause from data entered via search form --->
    <cfset WhereClause = " 0=0 ">
    <!--- Build subclause for trip location --->
    <cfif Form.tripLocationOperator GT "">
    <cfif Form.tripLocationOperator EQ "EQUALS">
    <cfset WhereClause = WhereClause & " and tripLocation = '" &
    form.tripLocationValue & "'">
    <cfelse>
    <cfset WhereClause = WhereClause & " and tripLocation = '" &
    form.tripLocationValue & "%'">
    </cfif>
    </cfif>
    <cfquery name="TripResult" datasource="CompassTravel">
    SELECT tripID, tripName, tripLocation, departureDate, returnDate, price
    FROM trips
    WHERE #PreserveSingleQuotes(WhereClause)#
    </cfquery>
    <cfreturn TripResult>
    </cffunction>


    KevCB Guest

  2. #2

    Default Re: Compass Travel example search not working

    Doesn't matter now, I missed out the 'Like' in the WHERE clause.

    It should have been:

    <cfset WhereClause = WhereClause & " and tripLocation Like '" & form.tripLocationValue & "%'">
    KevCB Guest

Similar Threads

  1. How to make a 3D compass
    By just_mik3 in forum Macromedia Director 3D
    Replies: 2
    Last Post: June 13th, 07:22 AM
  2. Compass rose
    By lukeskywalker in forum Macromedia Director 3D
    Replies: 1
    Last Post: April 26th, 02:43 PM

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
  •