Pada Sun, 25 Aug 2002 16:33:51 +0200 "andy" <[EMAIL PROTECTED]> menulis :
> 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? you can combine this with php script ... for mysql query you just do where field like "%$keyword%"; and you filter the result with if (strlen($fetch[field])<=100) { ...... ;-) > 2. Is it possible with php to underline the keyword inside the search > results. This might be more tricky. what do you mean by underline the keyword ? insert "underline" in search keyword ? or just underlining "keyword" found in the result. just do echo "bla bla bla bla ....",ereg_replace("$keyword","<u>$keyword</u>",$fetch[field])," ... end of bla bla bla"; -- Write clearly - don't be too clever. - The Elements of Programming Style (Kernighan & Plaugher) MySQL 3.23.51 : up 66 days, Queries : 356.493 per second (avg). -- Dicky Wahyu Purnomo - System Administrator PT FIRSTWAP : Jl Kapt. Tendean No. 34 - Jakarta Selatan 12790 Phone : +62 21 79199577 - HP : +62 8551044244 - Web : http://www.1rstwap.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php