Professional Web Applications Themes

Search results display problem - Coldfusion - Advanced Techniques

Hi, I am working on a dynamic results page that uses a form variable in the recordset. When I test the recordset it comes back with the correct results but when I check it using the results page I get no records returned. When I remove the form variable from the recordset the results page displays all of the records like it should. This one has me stumped. Here is the results page code with the form variable included. I am sure it is something simple and I just can't see it. Any help would be appreciated. Thanks, Shane <cfparam ...

  1. #1

    Default Search results display problem

    Hi, I am working on a dynamic results page that uses a form variable in the
    recordset. When I test the recordset it comes back with the correct results
    but when I check it using the results page I get no records returned. When I
    remove the form variable from the recordset the results page displays all of
    the records like it should. This one has me stumped. Here is the results page
    code with the form variable included. I am sure it is something simple and I
    just can't see it. Any help would be appreciated. Thanks, Shane

    <cfparam name="FORM.model" default="1">
    <cfparam name="PageNum_searchResultsTest" default="1">
    <cfquery name="searchResultsTest" datasource="saa">
    SELECT make, model, veh_year, ext_color, int_color, primary_image_path,
    mileage, price FROM saa.vehicle_ad WHERE model = '#FORM.model#' ORDER BY price
    ASC
    </cfquery>
    <cfset MaxRows_searchResultsTest=10>
    <cfset
    StartRow_searchResultsTest=Min((PageNum_searchResu ltsTest-1)*MaxRows_searchResul
    tsTest+1,Max(searchResultsTest.RecordCount,1))>
    <cfset
    EndRow_searchResultsTest=Min(StartRow_searchResult sTest+MaxRows_searchResultsTes
    t-1,searchResultsTest.RecordCount)>
    <cfset
    TotalPages_searchResultsTest=Ceiling(searchResults Test.RecordCount/MaxRows_searc
    hResultsTest)>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1" />
    <title>Untitled Doent</title>
    </head>

    <body>
    <table border="1">
    <tr>
    <td>make</td>
    <td>model</td>
    <td>veh_year</td>
    <td>ext_color</td>
    <td>int_color</td>
    <td>primary_image_path</td>
    <td>mileage</td>
    <td>price</td>
    </tr>
    <cfoutput query="searchResultsTest" startRow="#StartRow_searchResultsTest#"
    maxRows="#MaxRows_searchResultsTest#">
    <tr>
    <td>#searchResultsTest.make#</td>
    <td>#searchResultsTest.model#</td>
    <td>#searchResultsTest.veh_year#</td>
    <td>#searchResultsTest.ext_color#</td>
    <td>#searchResultsTest.int_color#</td>
    <td>#searchResultsTest.primary_image_path#</td>
    <td>#searchResultsTest.mileage#</td>
    <td>#searchResultsTest.price#</td>
    </tr>
    </cfoutput>
    </table>
    </body>
    </html>


    Shane930 Guest

  2. #2

    Default Re: Search results display problem

    What was the value of form.model?

    Are there actually any records that match it exactly?

    Originally posted by: Shane930
    Hi, I am working on a dynamic results page that uses a form variable in the
    recordset. When I test the recordset it comes back with the correct results
    but when I check it using the results page I get no records returned. When I
    remove the form variable from the recordset the results page displays all of
    the records like it should. This one has me stumped. Here is the results page
    code with the form variable included. I am sure it is something simple and I
    just can't see it. Any help would be appreciated. Thanks, Shane

    <cfparam name="FORM.model" default="1">
    <cfparam name="PageNum_searchResultsTest" default="1">
    <cfquery name="searchResultsTest" datasource="saa">
    SELECT make, model, veh_year, ext_color, int_color, primary_image_path,
    mileage, price FROM saa.vehicle_ad WHERE model = '#FORM.model#' ORDER BY price
    ASC
    </cfquery>
    <cfset MaxRows_searchResultsTest=10>
    <cfset
    StartRow_searchResultsTest=Min((PageNum_searchResu ltsTest-1)*MaxRows_searchResul
    tsTest+1,Max(searchResultsTest.RecordCount,1))>
    <cfset
    EndRow_searchResultsTest=Min(StartRow_searchResult sTest+MaxRows_searchResultsTes
    t-1,searchResultsTest.RecordCount)>
    <cfset
    TotalPages_searchResultsTest=Ceiling(searchResults Test.RecordCount/MaxRows_searc
    hResultsTest)>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1" />
    <title>Untitled Doent</title>
    </head>

    <body>
    <table border="1">
    <tr>
    <td>make</td>
    <td>model</td>
    <td>veh_year</td>
    <td>ext_color</td>
    <td>int_color</td>
    <td>primary_image_path</td>
    <td>mileage</td>
    <td>price</td>
    </tr>
    <cfoutput query="searchResultsTest" startRow="#StartRow_searchResultsTest#"
    maxRows="#MaxRows_searchResultsTest#">
    <tr>
    <td>#searchResultsTest.make#</td>
    <td>#searchResultsTest.model#</td>
    <td>#searchResultsTest.veh_year#</td>
    <td>#searchResultsTest.ext_color#</td>
    <td>#searchResultsTest.int_color#</td>
    <td>#searchResultsTest.primary_image_path#</td>
    <td>#searchResultsTest.mileage#</td>
    <td>#searchResultsTest.price#</td>
    </tr>
    </cfoutput>
    </table>
    </body>
    </html>




    Dan Guest

  3. #3

    Default Re: Search results display problem

    Hi Dan, the model is "Odyssey" and there are 4 records in the DB that match it exactly. I am not sure if it is a CF output issue or how I have the query set up.

    Thanks for you help

    Shane
    Shane930 Guest

  4. #4

    Default Re: Search results display problem

    Turn on your de-bugging, and look at the query. See if there are any records
    returned. If not, copy and paste it into something that will run against your
    database directly, without cold fusion.

    Things that could mess you up are,
    - leading or trailing spaces
    - mixed case compared to upper or lower case.

    Originally posted by: Shane930
    Hi Dan, the model is "Odyssey" and there are 4 records in the DB that match it
    exactly. I am not sure if it is a CF output issue or how I have the query set
    up.

    Thanks for you help

    Shane



    Dan Guest

Similar Threads

  1. Display search results from Flash Form to CFGrid
    By dpinder123 in forum Coldfusion Flash Integration
    Replies: 19
    Last Post: September 27th, 01:40 AM
  2. Cfgrid to display search results
    By grice in forum Coldfusion Flash Integration
    Replies: 2
    Last Post: March 24th, 02:11 PM
  3. problem with querying search results
    By choirellie in forum Macromedia ColdFusion
    Replies: 1
    Last Post: March 24th, 02:02 AM
  4. PHP-CSV echo results display problem
    By JDJones in forum PHP Development
    Replies: 3
    Last Post: January 28th, 02:34 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
  •  

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