Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 17th, 2003, 03:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default search feature

Hi there

I don't know if I'm barking up the wrong tree here but I've built this search facility that returns the user specific records from the database (SQL). However, what I would like to do is bold whatever the user puts into the search field for the returned records. For example, if the user keyed in smith, then the results page would bold the word smith

I hope I've explained that correctly!

Thanks

Adam
Reply With Quote
  #2 (permalink)  
Old July 17th, 2003, 05:20 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Adam,

It all depends on the way you have coded your solution. The easiest way to do it is to simply use the VBScript Replace method to replace the search word with the search word surrounded by <strong> tags.

Here's an example (I assume you have a field in your Recordset called "Description" for example):

[old]
Code:
Response.Write("<td>" & rsSearchResults("Description") & "</td>")
[new]
Code:
Response.Write("<td>" & Replace(rsSearchResults("Description"), SearchFor, _
    "<strong>" & SearchFor & "</strong></td>")
    This will surround all occurences of SearchFor with the <strong> tags.

Depending on the stuff that is in the database and the terms users are searching for, this may not always give the right results.....


HtH

Imar






---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to implemtn Search feature vinu123 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 February 9th, 2007 02:36 AM
c# feature request? jtpopol C# 2005 0 September 29th, 2006 02:45 AM
New Feature Request Ben Horne Forum and Wrox.com Feedback 12 April 28th, 2004 02:37 PM
Another Feature Request Imar Forum and Wrox.com Feedback 0 September 10th, 2003 01:57 PM
Feature Request Imar Forum and Wrox.com Feedback 9 September 2nd, 2003 08:24 AM



All times are GMT -4. The time now is 06:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.