title: MYSQL and PHP search script with word list and links
body: <p>I'm working on a search form/script for my website.</p>
  
  <p>For a start every word used in content on my website is stored in a MYSQL table called <code>words</code> and it looks something like this :</p>
  
  <pre><code>id |  word | title_count | content_count | article_count | photo_count | video_count |
  ---+-------+-------------+---------------+---------------+-------------+-------------+
   1 | hello |           3 |             1 |             0 |           1 |           0 |
   2 |  what |           1 |             4 |             1 |           0 |           0 |
  </code></pre>
  
  <p>The <code>word</code> and <code>id</code> fields are UNIQUE, the fields <code>title_count</code> and <code>content_count</code> are used to store how many time the word was used in a title or in a main content.
  The other <code>_count</code> field just say how many time the word was used in an article/photo/video. </p>
  
  <p>I'm not sure if all these count fields will be useful for a search function, but thought it could maybe come in handy.</p>
  
  <p>Then I have multiple linking tables to all the <code>_count</code> fields of the <code>words</code> table that look like this : </p>
  
  <pre><code>id |  word_id | 
  ---+----------+
  43 |        2 |
   7 |        1 |
   7 |        2 |
  </code></pre>
  
  <p>These tables are called : <code>word_link_title</code>, <code>word_link_content</code>, <code>word_link_article</code>, <code>word_link_photo</code>, <code>word_link_video</code> etc. The <code>id</code> field stores the id of a article/photo/video it links to and the <code>word_id</code> stores the the ID of the word linked.</p>
  
  <p>Now that I have all of that set up I'm kind of stuck. I don't really have any clear idea how to sort out relevant content based on all these numbers and the research terms. </p>
  
  <p>Something that I plan on doing is a search result page with multiple tabs, one there it would show all the results of the search and then in other tabs it would be separated in articles/photos/videos.</p>
  
  <p>I have no idea if I'm actually on the right path to get something working. Hope someone can help me..</p>