title: Column 'keywords' in where clause is ambiguous
body: <p>right, my code below is for taking rows from a MYSQL table and displaying them when the user input matches a keyword stored. recently i have decided it is stupid to have one long table and that sometimes, with similar keywords, the higher id comes out on top. if i have multiple tables, with specific sections like 'news' 'film' i should avoid the clash.</p>
  
  <pre><code>  &lt;?php
    if( count($terms) == 0){ // If no terms entered, stop.
  echo "No Search Terms Entered.";
      }else{      
  
   // connect
    $connect = mysql_connect("cust-mysql-123-05", "uthe_774575_0001", "rooney08") or   die('Couldn\'t connect to MySQL Server: ' . mysql_error());
      mysql_select_db("theqlickcom_774575_db1", $connect ) or die('Couldn\'t Select the database: ' . mysql_error( $connect ));
  
  /* Query Statement Building - Terms together */
  $query = " SELECT * FROM scan WHERE "; 
  
  $terms = array_map('mysql_real_escape_string', $terms);
  $i = 0; 
  foreach ($terms as $each) {
        if ($i++ !== 0){
              $query .= " AND ";
        }
        $query .= "keywords LIKE '%{$each}%'";
  }
  
  
  
  $query = mysql_query($query) or die('MySQL Query Error: ' . mysql_error( $connect ));
  $numrows = mysql_num_rows($query);
  if ($numrows &gt; 0) {
  
        while ($row = mysql_fetch_assoc($query)) {
              $id = $row['id'];
              $title = $row['title'];
              $description = $row['description'];
              $keywords = $row['keywords'];
              $link = $row['link'];
  
          echo '&lt;h2&gt;&lt;a class="ok" href="' . $link . '"&gt;' . $title . '&lt;/a&gt;&lt;/h2&gt;' . PHP_EOL;
                      echo '&lt;p class="kk"&gt;' . $description . '&lt;br&gt;&lt;br&gt;&lt;span class="keywords"&gt;' . PHP_EOL;            
                      echo '&lt;p&gt;&lt;a class="okay" href="' . $link . '"&gt;' . $link . '&lt;br&gt;&lt;br&gt;&lt;span class="keywords"&gt;' . PHP_EOL;
                        }
  } else {
      /* Query Statement Building - Terms Separate */
      $query = " SELECT * FROM scan WHERE "; 
  
      $terms = array_map('mysql_real_escape_string', $terms);
      $i = 0; 
      foreach ($terms as $each) {
            if ($i++ !== 0){
                  $query .= " OR ";
            }
            $query .= "keywords LIKE '%{$each}%'";
      }
  
      $query = mysql_query($query) or die('MySQL Query Error: ' . mysql_error( $connect ));
      $numrows = mysql_num_rows($query);
      if ($numrows &gt; 0) {
  
            while ($row = mysql_fetch_assoc($query)) {
                  $id = $row['id'];
                  $title = $row['title'];
                  $description = $row['description'];
                  $keywords = $row['keywords'];
                  $link = $row['link'];
  
                  echo '&lt;h2&gt;&lt;a class="ok" href="' . $link . '"&gt;' . $title . '&lt;/a&gt;&lt;/h2&gt;' . PHP_EOL;
                  echo '&lt;p class="kk"&gt;' . $description . '&lt;br&gt;&lt;br&gt;&lt;span class="keywords"&gt;' . PHP_EOL;            
                  echo '&lt;p&gt;&lt;a class="okay" href="' . $link . '"&gt;' . $link . '&lt;br&gt;&lt;br&gt;&lt;span class="keywords"&gt;' . PHP_EOL;
                    }
  
      } else {
            echo "No results found for \"&lt;b&gt;{$k}&lt;/b&gt;\""; 
      }
  }
  //disconnect
   }
   ?&gt; 
  </code></pre>