SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Advanced Search

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Manila, Philippines
    0 Post(s)
    0 Thread(s)

    Advanced Search

    I've used the MATCH function in MYSQL for searching but there is a minor problem...For example, if someone searches for "Reebok Shoes", I would like to show exact match wherein only Reebok shoes appear but using the MATCH function returns data like Reebok jackets or all data that has the word shoes on it which is pretty messy. How do i go about this? Thanks.

  2. #2
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    North Pole
    0 Post(s)
    0 Thread(s)
    i think you have two options, do more than one query, using an exact match, the LIKE function, then MATCH function, or do a single query and then sort the array.

    From what i understand tho, you only want close to exact matches, so just use LIKE and you should get the desired effect, other wise try this...
    sorting the array, you will have to pull out any elements where its is exact, and add the rets on the end.

    Try this
    PHP Code:
    foreach($array as $item){
    $item['name'] == $search){
    $newarr[] = $item;
    $oldarr[] = $item;
    $arr2 $newarr;
    $oldarr as $arrele){
    $arr2[] = $arrele;
    Note, $newarr has all EXACT or close to exact matches, $oldarr has the other items, and $arr2 has both of them, and if you use a loop you will get the most signifigant matches first


Posting Permissions

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