SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    FULLTEXT Match Against

    Hi guys,

    I'm having a little issue with a fulltext match against query.

    I have a table with a list of people's full names. Example

    Bob Saget
    Bob Johnson
    Bob Thompson

    now... If I search for "johnson" it will find "Bob Johnson"

    however, If I search for "Bob" it won't find anything.

    I've noticed that if there are more than two matching results, it won't find any results. If it's two or less, it finds it perfectly. Any ideas?

    Here's my code

    Code:
    $search_query = mysql_query("SELECT * FROM users WHERE MATCH(full_name) AGAINST('$user_searched')")or die(mysql_error());
    
    while($search_array = mysql_fetch_array($search_query)){
    extract($search_array);
    
    echo"$full_name - $username<br>";    
    }
    I live in Madison. Where in the W1RLD do you live?

  2. #2
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,077
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Code SQL:
    SELECT *
    FROM users
    WHERE
    full_name LIKE '%$user_searched%'

    That will search for all users whose name contains the string. To match names starting with the string, remove the lefthand %
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


Bookmarks

Posting Permissions

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