SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    FULLTEXT function - added after?

    I found this cool function on http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html
    PHP Code:
    CREATE TABLE articles (
        -> 
    id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
        -> 
    title VARCHAR(200),
        -> 
    body TEXT,
        -> 
    FULLTEXT (title,body)
        -> );
    // afterwhich you can query:
    $querymysql_query("SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('database')"); 
    What I was wondering, since I have a search function on my website, but haven't got the FULLTEXT thing on:

    Can I add the FULLTEXT function on my Table afterwards? The table has been created some time ago and is filled with about 250 rows.

    Any help is appreciated!
    Jazz

  2. #2
    SitePoint Zealot manoloweb's Avatar
    Join Date
    Aug 2003
    Location
    Mexico
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure you can.

    ALTER TABLE `tablename` ADD FULLTEXT indexName (fieldName)

  3. #3
    SitePoint Evangelist jazztie's Avatar
    Join Date
    Mar 2001
    Location
    the Netherlands
    Posts
    519
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    great! Thanx, Manoloweb


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
  •