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
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=\#FF\.$keywords[$i]./font , $blurb);
}
where
for ($i=0; $i count($keywords); $i++) {
$blurb = eregi_replace( .$keywords[$i]. , font
color=\#FF\.$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
andy,
I find the PCRE regex option easier to work with. Herewith a solution which
takes care of case (without changing the original text), and without regard
to spaces or other characters (including the first and last characters of
the string - which you didn't mention/identify as potential
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]
The first argument passed to eregi_replace is
.$keywords[$i].
You are concatenating the string and a space on the end and front. This was
obviously used as a hack to make sure only full words were highlighted. A
fix for this? A simple hack would be to take out the spaces, so it is simply