MySQL Searching Entire Tables

Discussion in 'PHP' started by Kennedy, Feb 6, 2008.

  1. #1
    What would be a query for searching an entire database for a word or multiple words? Not just searching a single row. For example searching the "pagetitle" and "description" fields from the entire database for the words "clockwork orange".
     
    Kennedy, Feb 6, 2008 IP
  2. The Critic

    The Critic Peon

    Messages:
    392
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SELECT queries automatically search an entire table for the parameters in the WHERE clause unless you tell it not to by specifying a LIMIT.
     
    The Critic, Feb 6, 2008 IP
  3. Kennedy

    Kennedy Peon

    Messages:
    994
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm looking for something like this:

    $query="SELECT * FROM vids WHERE desc LIKE '$q' || tags LIKE '$q'";

    But that doesn't work.
     
    Kennedy, Feb 6, 2008 IP
  4. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    $query="SELECT * FROM vids WHERE desc LIKE '%$q%' OR tags LIKE '%$q%'";
     
    CreativeClans, Feb 7, 2008 IP