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

  1. #1

    Default help with search

    :D hi there guys, please can you help me, my search does not display any
    results, please help me befor my boss gives me a spanking! Here are my pages
    search.cfm and searchresult.cfm, please tell me where i went wrong and i'll
    give you a big kiss!

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>search</title>
    </head>
    <body>
    Please enter your search text:
    <table>

    <form action="searchresult.cfm" method="post">
    <tr><td>
    Business Name: <input type="text" name="BusinessName" size="20">
    <input type="hidden" name="BusinessName" value="#BusinessName#">
    </td></tr>
    <tr><td>
    Description: <input type="text" name="Description" size="20">
    <input type="hidden" name="Description" value="#Description#">
    </td></tr>
    <tr><td>
    Tel: <input type="text" name="Tel" size="20">
    <input type="hidden" name="Tel" value="#Tel#">
    </td></tr>
    <tr><td>
    Email: <input type="text" name="Email" size="20">
    <input type="hidden" name="Email" value="#Email#">
    </td></tr>
    <tr><td>
    Website: <input type="text" name="Website" size="20">
    <input type="hidden" name="Website" value="#Website#">
    </td></tr>
    <tr><td>
    <input type="submit" value="search">
    <input type="reset" value="clear">
    </td></tr>
    </form>
    </table>
    </body>
    </html>


    searchresult
    <cfquery datasource="ele_stone" username="ele_stone" password="rock"
    name="businesses">
    select *
    from ws_directory
    where dud = 0
    <cfif BusinessName neq "">
    and BusinessName like '#BusinessName#%'
    </cfif>
    <cfif Description neq "">
    and Description like '#Description#%'
    </cfif>
    <cfif Tel neq "">
    and Tel like '#Tel#%'
    </cfif>
    <cfif Email neq "">
    and Email like '#Email#%'
    </cfif>
    <cfif Website neq "">
    and Website like '#Website#%'
    </cfif>
    order by BusinessName
    </cfquery>
    <html>
    <head>
    <title>Search Results</title>
    </head>

    <body>
    <b><cfoutput>Found #businesses.RecordCount# Businesses</cfoutput></b>
    <table>
    <cfoutput query="businesses">
    <tr><td>BusinessName: #BusinessName#</td></tr>
    <tr><td>Description: #Description#</td></tr>
    <tr><td>Tel: #Tel#</td></tr>
    <tr><td>Email: #Email#</td></tr>
    <tr><td>Website: #Website#</td></tr>
    </cfoutput>
    </table>
    </body>
    </html>

    susie_blond Guest

  2. Similar Questions and Discussions

    1. ANN: InterAKT Site Search - search in multiple tables
      Hello, We have just released a new product, MX Site Search, meant to help web developers and designers create a search form in their dynamic...
    2. #25786 [NEW]: PHP website uses cookies to remember last search phrase in search box
      From: tipsen at imada dot sdu dot dk Operating system: - PHP version: Irrelevant PHP Bug Type: Unknown/Other Function Bug...
    3. Search within Search Results
      I am trying to do a search within query results: My first search executes fine, but my second search uses the WHERE parameters of my first...
    4. search box HELP!
      One of these should do:- http://perso.planetb.fr/newton/#text http://tinyurl.com/m2zm Andrew Morton
    5. XP Search - how to not search inside .ZIP files
      Is there any way to make the Windows Explorer Search facility not search the contents of .ZIP files?
  3. #2

    Default Re: help with search

    do you have a field named dud that always = 0?
    Dan Bracuk Guest

  4. #3

    Default Re: help with search

    yes i do, my boss told me to do that!
    susie_blond Guest

  5. #4

    Default Re: help with search

    The way to troubleshoot this is:
    start with
    select count(*)
    from ws_directory
    where dud = 0

    and see what you get
    then start adding your "and" lines
    ( eg and Description like '#Description#%')
    one by one until your query returns 0.

    Things that might help are:
    1. putting a wildcard at the front of the string as well.
    2. forcing casesensitivity (if your db supports it)
    (where upper(description like '#ucase(Description)#%')




    Dan Bracuk 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