Yeah I had the same problem - also with question marks, quotes etc - I
couldn't figure out a fix for it - if you do - please lemme know!

cheers

stuart
----- Original Message -----
From: "andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 25, 2002 11:40 PM
Subject: Re: [PHP-DB] full text search and how to underline keyword in
results


> > for ($i=0; $i < count($keywords); $i++) {
> >     $blurb = eregi_replace(" ".$keywords[$i]." ", " <font
> > color=\"#FF0000\">".$keywords[$i]."</font> ", $blurb);
> > }
>
> Hello Stuart,
>
> great, thats a first success and works fast.
>
> There are just 2 things which fail on this function:
> 1. Problems with full stops. A word with a full stop will be ignored (e.g
> singapore. will not be found if you search for singapore)
> 2. If you search for singapore and there is a hit Singapore (notice the
> capital!) will be replaced with singapore in the text.
>
> I tryed to fix that, but I fear that my php experiance lacks on this stage
> :-(
>
> Maybe someone else or you do have a idea for a fix?
>
> Cheers Andy
>
>
>
> "Stuart McDonald" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> 001901c24c45$2a5e6940$0100a8c0@stuart">news:001901c24c45$2a5e6940$0100a8c0@stuart...
> > Hi Andy,
> >
> > In answer to part two - here's a snippet of code I use to highlight
> relevant
> > words in red - hope it helps to put you on the right track.
> >
> > for ($i=0; $i < count($keywords); $i++) {
> >     $blurb = eregi_replace(" ".$keywords[$i]." ", " <font
> > color=\"#FF0000\">".$keywords[$i]."</font> ", $blurb);
> > }
> >
> > where $keywords is an array containing all the words searched for and
> $blurb
> > is the snippet that is returned with the search results At this stage in
> the
> > flow, I've already retrieved relevant records - this is in fact the last
> > step before I format and display the results..
> >
> > Hope this helps
> >
> > stuart
> >
> >
> > ----- Original Message -----
> > From: "andy" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, August 25, 2002 9:32 PM
> > Subject: [PHP-DB] full text search and how to underline keyword in
results
> >
> >
> > > Hi there,
> > >
> > > I am trying to write a php script to perform a full text search on a
> mysql
> > > db. I do a match against... and it digs out some results out of the
db.
> > >
> > > There are 2 problems:
> > >
> > > 1. How can I restrict the results to e.g. 100 characters, but to make
> sure
> > > the keyword is within this 100 characters?
> > > 2. Is it possible with php to underline the keyword inside the search
> > > results. This might be more tricky.
> > >
> > > Thank you for any help on that,
> > >
> > > Andy
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to