Problem with Database Search

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Problem with Database Search

    Hi,

    I am trying to repair a website's directory search but can't pinpoint the
    problem(s). Basically, when I input a person's full name, the search yields no
    results. If I input a single name, results appear, which is fine. Also,
    another problem is the keyword search. It doesn't work at all. Can someone
    help me to figure this out? Here is the code for the query:

    <!-- display search results -->
    <CFQUERY NAME="GetMatches" DATASOURCE="#application.dsn#">
    SELECT *
    FROM MemberData
    WHERE 1=1
    <CFIF Country NEQ "All">
    AND Country = '#Country#'
    </CFIF>
    <CFIF State NEQ "All">
    AND State = '#State#'
    </CFIF>
    <CFIF form.Searchname NEQ "">
    AND (Firstname LIKE '%#form.searchname#%' OR Lastname LIKE
    '%#form.searchname#%' OR Company LIKE '%#form.searchname#%')
    </CFIF>
    <CFIF form.searchKeywords NEQ "">
    AND CONTAINS (MemberData.*, '#form.searchKeywords#')
    </CFIF>
    ORDER BY LastName
    </CFQUERY>

    Here is a link to the website as well:

    [url]http://www.pngdealers.com/public/dealerDirectory.cfm[/url]

    Thanks,
    Christine

    ifritshorn Guest

  2. Similar Questions and Discussions

    1. Simple database search problem
      I'm trying to setup a simple database search, however when I test the page, the search yields all the records in the database. Connection to MySQL...
    2. Database Search
      I've set up an alumni program for my school and am having trouble with the search page where a user can search for another user by name or UserID. ...
    3. search the database
      Hi i currently have a search feature on my site and it currently only searches one table, i want it to search another table too??? does anyone...
    4. Web search in SQL database
      I try to create a search engigne to query a SQL database. I use asp.net with c#, but i have some problems. I want my users insert whatever they want...
    5. database search in CD
      Hello, How can i do a keyword search using flash in CD? I can`t acess internet or install a db in the user drive. Is there a way to do it in...
  3. #2

    Default Re: Problem with Database Search

    Hi There, The way the query is set up it searches the firstname and surname
    fields separately. So if you entered a person's full name it wouldn't match
    either of these fields and hence no records were returned. You could try
    modifying the bit that searches the name and company to the following,
    assuming that someone would enter a space between the irst and last names.
    Cheers Andy

    <CFIF form.Searchname NEQ "">
    AND (Firstname LIKE '%#form.searchname#%' OR Lastname LIKE
    '%#form.searchname#%' OR Firstname + ' ' + Lastname LIKE '%#form.searchname#%'
    OR Company LIKE '%#form.searchname#%')
    </CFIF>

    Chugglethwaite Guest

Posting Permissions

  • You may not post new threads
  • You may 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