Need help with a search code.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • --~AngelisIIDX~--

    Need help with a search code.

    Hey ya guys. Just a pre thank you for any help or info.

    Basically here is what is going on. I have a search engine I've been working
    on and as of right now it is working with multiple key words. The problem
    I'm having is that when you enter a search term it will bounce back
    everything for each key word and not comparing them. I honestly don't know
    how to do this, being new to the whole PHP/SQL.

    This is what I'm using right now for the mysql string to search:
    $result = mysql_query("SE LECT * FROM ptvideos2 WHERE search LIKE
    '%$search_words[$i]%' ");

    any ideas?

  • Jerry Stuckle

    #2
    Re: Need help with a search code.

    --~AngelisIIDX~-- wrote:
    Hey ya guys. Just a pre thank you for any help or info.
    >
    Basically here is what is going on. I have a search engine I've been
    working on and as of right now it is working with multiple key words.
    The problem I'm having is that when you enter a search term it will
    bounce back everything for each key word and not comparing them. I
    honestly don't know how to do this, being new to the whole PHP/SQL.
    >
    This is what I'm using right now for the mysql string to search:
    $result = mysql_query("SE LECT * FROM ptvideos2 WHERE search LIKE
    '%$search_words[$i]%' ");
    >
    any ideas?
    >
    I suggest you ask SQL questions in comp.databases. mysql. You'll get
    better help over there.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • robert stearns

      #3
      Re: Need help with a search code.

      --~AngelisIIDX~-- wrote:
      Hey ya guys. Just a pre thank you for any help or info.
      >
      Basically here is what is going on. I have a search engine I've been
      working on and as of right now it is working with multiple key words.
      The problem I'm having is that when you enter a search term it will
      bounce back everything for each key word and not comparing them. I
      honestly don't know how to do this, being new to the whole PHP/SQL.
      >
      This is what I'm using right now for the mysql string to search:
      $result = mysql_query("SE LECT * FROM ptvideos2 WHERE search LIKE
      '%$search_words[$i]%' ");
      >
      any ideas?
      what you probably want is something like:
      $sql = "SELECT * FROM ptvideos2 WHERE ";
      $oper = "";
      foreach( $search_words, $aword) {
      $sql = $sql . "search LIKE %" . $aword . "%" . $oper;
      $oper = " AND ";
      }
      $result = mysql_query($sq l);

      But boy is this going to be slow on any appreciable sized db. Do a
      google search on text searching or inverted indexes.

      PS This is untested code, off the top of my head. Test extensively
      before using.

      Comment

      • salmobytes

        #4
        Re: Need help with a search code.

        --~AngelisIIDX~-- wrote:
        I have a search engine I've been
        working on and
        any ideas?
        Google hyperestraier

        Comment

        • Betikci Boris

          #5
          Re: Need help with a search code.

          On Oct 7, 12:19 am, "--~AngelisIIDX~--" <fwrote:
          Hey ya guys. Just a pre thank you for any help or info.
          >
          Basically here is what is going on. I have a search engine I've been working
          on and as of right now it is working with multiple key words. The problem
          I'm having is that when you enter a search term it will bounce back
          everything for each key word and not comparing them. I honestly don't know
          how to do this, being new to the whole PHP/SQL.
          >
          This is what I'm using right now for the mysql string to search:
          $result = mysql_query("SE LECT * FROM ptvideos2 WHERE search LIKE
          '%$search_words[$i]%' ");
          >
          any ideas?
          You have to fetch almost everything from database, and have to process
          it according to your algorythm. I suggest use Php Data Objects - PDO -
          class, processing become much easier.

          Comment

          Working...