Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    202

    Unanswered: Develop a search page

    Hi there,

    I'm trying to develop a page when user can search for anything in the database.the problem i'm facing is how to display the data in a table where all the data can be in a column and row dynamically.

    Thanx

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Look up "While" loops. Once you've queried your DB, you'll have a recordset. With that recordset you can loop through it with a "While" statement to display your table:

    For Example...
    Code:
    <table>
    <%
    '''Open a connection and query the DB for a recordset'''
    
    While NOT Recordset.EOF    'EOF = End Of File
      Response.Write "<tr><td>" & Recordset("Value1") & "</td></tr>" & vbCRLF
      Recordset.MoveNext
    WEnd
    
    '''Close your recordset and DB connection'''
    %>
    </table>
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Mar 2004
    Posts
    202
    hi there,

    what if one of the record which display in the search box need to be link to another page which will tell more about the product....................how would i do that?
    i mean like this:

    Turkey---------------123445
    Malaysia--------------211212
    England---------------22122
    US---------------------121212

    the above is the record which are display when i key in sumting to look for it........
    what should i do when i want to click Malaysia for example and i want another web page to be load to explain more about malaysia.

    thanx
    exactly like yahoo search page.

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Simply make some text a link, such as the country, passing a query string value populated by the recordset. Then your detail page will use the query string value from Request.QueryString("ID") to query the database for more information.

    Code:
    <table>
    <%
    '''Open a connection and query the DB for a recordset'''
    
    While NOT Recordset.EOF    'EOF = End Of File
      Response.Write "<tr><td><a href=""detailpage.asp?ID=" & Recordset("ID") & """>" & Recordset("Value1") & "</a></td></tr>" & vbCRLF
      Recordset.MoveNext
    WEnd
    
    '''Close your recordset and DB connection'''
    %>
    </table>
    That which does not kill me postpones the inevitable.

  5. #5
    Join Date
    Mar 2004
    Posts
    202
    hi there,

    Thanx for your help.I really appreciate it.
    Can already.
    Thanx again

  6. #6
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    "I'm trying to develop a page when user can search for anything in the database"

    And here's a related link that might hopefully help somewhat at least with building the SQL string itself:

    ASP Design Tips - Search For an Expression on Multiple Fields
    http://www.bullschmidt.com/devtip-se...iplefields.asp
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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