Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts

    highlight search terms after PHP search

    Can anyone offer me some information on how forums like these highlight the search terms after a search is done? and how the search is done?

    Is there a shortcut method or useful tool in PHP other than scanning a database by searching every field for search terms?

    Or is it as simple as:
    PHP Code:
    $q select from db where field LIKE '*' searchterms '*'
    I'm curious. I would like to list many articles and functions on my site, but I want to offer a search page as well, that will search an entire database for records that contain the search terms, regardless of what field they are in. Is that an easy thing to do?

    thanks!

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    If you're using MySQL you can use a FULLTEXT Index.

    http://dev.mysql.com/doc/refman/5.0/...xt-search.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •