MySQL Coldfusion search?

Posted on 2007-10-19
Last Modified: 2013-12-24
I'm using Coldfusion and MySQL for searching data. A rich text editor has been used to setup subscripts and superscripts so my data might look like this in one field 8<sub>2</sub>9 and so on. Now if I had a user wanting to find all value of 829 how could this be done without recognizing the tags to subscript the text? It's just that no results come up for 829 but they do if I type 8<sub>2</sub>9

Question by:brihol44
    LVL 2

    Accepted Solution

    If you want the user to "get what you typed", perhaps it's simpler to have the same Rich Text Editor (RTE) for entering the search term. So the if the user enters 8<sub>2</sub>9 (of course, with help from your RTE), that's what he would get.
    Most of the times it's not a very feasible option to have an RTE as the search-box, but you are the best judge for your app.

    Another option, if you don't want to use RTE for inputting search terms, is to have duplicate columns for all searchable fields that contain html tags. While inserting the records, strip off all the html tags and query these "sanitized" fields for matching search terms.

    Neither solution is elegant, but the end users don't care ;-)
    LVL 11

    Assisted Solution

    One solution could be remove the <sub> and </sub> on the fly while you run the SQL query.
    Here is an example.

    That might help.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now