Search function

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi all

I have a search function on a site of mine.  At the moment, the content is
delivered using this:

<?php echo $row_Recordset1['content']; ?>

The search function goes through the table and displays the titles of the
pages that contain the term.

What I'd like to do is set it up so that when the visitor clicks on a title,
it sends the search term as well, looks for it in
$row_Recordset1['content']; and puts <strong> before and </strong> after.

Does that make sense?

Also, I've just noticed something not right.  The CMS takes a text box and
writes the HTML into the table.  So, if I do a search on </li> for example,
then it brings back results.  I can't even begin to imagine a way round
this.  In most cases this is unlikely to be a problem but I'd like to think
there might be a way round it.

Any help would be gratefully received.


Re: Search function

convert < and > to &lt; and &gt; using html_specialcharacters() - ive prob
got the function name wrong -. and then search using that.

- Ali

Quoted text here. Click to load it

Re: Search function

On 25/4/05 3:24 pm, in article, "Alistair

Quoted text here. Click to load it

But then doing a search on /li would still work, or any other HTML tags,
just without the <>.

I'm not convinced that it's a major problem as I can't think that anyone
using a site would be searching using HTML anyway.  I've been trying to
think of something where a 'real' word that someone would search for might
also be an html tag but it's going to be rare, I think.


Quoted text here. Click to load it

Re: Search function

other than the words Strong, and Quote, I dont think you'll get any, and
assuming you use <b> then strong wont be a problem.

I beleive you can use Regular expressions within SQL searches, u could try
doing a search for where the wrod exists, but is not within a < > ?

but as you said, its unlikley to be a problem thats worth bothering about.

- ali

Quoted text here. Click to load it

Site Timeline