0 Replies Latest reply on Jul 6, 2010 4:19 PM by robertaustin2010

    Fulltext search help

    robertaustin2010

      Hi this might be the wrong place to put this question but i need help as i'm a newbie

       

      What I want to do if create a full search for my users so they can search my database on fishing locations in the UK, I have set up a database with 1 table and 7 columns the columns are named id, country, area, river, beat, desc and img, I want my users to be able to search 4 of these columns (country, area, river, beat)

       

      Basically what I am asking is if a user types in "fishing in (country) or (area) on the (river) at (beat)" or "I would like to fish in (area) on the (river)" and it comes up with results or lists of rivers and beats in that area

       

      I have tried many different ways and nothing seems to work my last effort was with this code

       

      <?php
          if ($c != 1) {
      ?>
      <form action="this.php?c=1">
      <input type="text" name="keyword">
      <input type="submit" value="Search!">
      </form>
      <?php
          } else if ($c==1) {
              MySQL_connect("localhoste", "root", "robert");
              MySQL_select_db("fish_db");
              $sql = "
                  SELECT *,
                      MATCH(tb_country, tb_area, tb_river, tb_beat, tb_desc) AGAINST('$keyword') AS score
                      FROM articles
                  WHERE MATCH(tb_country, tb_area, tb_river, tb_beat, tb_desc) AGAINST('$keyword')
                  ORDER BY score DESC
              ";
              $res = MySQL_query($sql);

       

      If anyone could help or point me in the right direction i would be very very greatful

       

      Thanks

       

      Rob