help with sql for autocomplete script
Posted on 2006-06-05
i'm writing an AJAX/php autocomplete script for search..
and got some problems...
i have a db, with text like
"Hockey Night In Canda"
i have 2000+ records and growing,
i need some way to make it quick (as much as posible) even when it'll be 100,000+ records (and it will)
anyway, my script looks for user input in text box, when he inputs more then 3 chars, it starts checking the db, all works fine,
exept the sql =]
what i have now is:
SELECT title FROM tbl_titles where (title like '%$search%' and cat='$cat');
what i wont is to select only the matching words, and not the whole phrase, and to output them one by one
like autocomplete... (where "comp" is "computer","compilation","comparison" .........)