Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2003, 03:33 AM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old July 17th, 2003, 05:20 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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.





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.