www.webdeveloper.com
Results 1 to 3 of 3

Thread: Search MySQL db for word

  1. #1
    Join Date
    Dec 2010
    Posts
    1

    Search MySQL db for word

    Hello, I am trying to search a database for a word, except I do not even know what table or field it is in. Could anyone please help me with the syntax to search the entire database? Thanks in advance.

  2. #2
    Join Date
    Feb 2003
    Posts
    102
    Hey mate,

    You might want to look into the Sphinx plugin... http://sphinxsearch.com

    Outside of that, I'm not sure how you would do such a search without a heap of manual JOINs.

    Sorry for the less-than-ideal reply. I'm a bit of a noob myself when it comes to this stuff! Sphinx does sound promising though!


    Cheers,

    Chris

  3. #3
    Join Date
    Mar 2010
    Posts
    672
    Assuming your tables are MyISAM (the default) then you can look into using fulltext indexing and searching (aka, match(field1,field2,field3) against('word")... ). You can grab results using a single query if all th fields are in one table, in they're in multiple tables you can do a union of the results.
    To do this you'll need to add fulltext indexes to each of the fields you want to search. For performance sake, the default settings create indexes for words greater than 3 characters, but you can change that setting if need be.
    Here's a helpful page on fulltext searching:
    http://devzone.zend.com/article/1304

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles