I have the following test items in my glossary"

CSS
Cascading Style Sheet - a hierarchical means of specifying how to format HTML elements on the page.
Drupal
An open-source content management system that is used on this site and that is saving the world, one web site at a time.

Here is the search code (which works just fine in 5.x:

function glossary_search_results($keys = null) {
  $vids = _glossary_get_filter_vids();
  $output = '<dl class="glossary-list">';
 
  $sql = "SELECT tid FROM {term_data} WHERE vid IN (". db_placeholders($vids) .") AND (description LIKE '%%%s%%' OR name LIKE '%%%s%%')";
  $result = db_query($sql, $vids, $keys, $keys);
  $count = 0;
  while ($row = db_fetch_object($result)) {
    ++$count;
    $term = taxonomy_get_term($row->tid);
    $output .= theme('glossary_overview_item', $term, true);
  }
  if ($count == 0) {
    $output .= t("I'm sorry, I couldn't find any terms with that search.");
  }
  return $output .'</dl>';
}

However, this is failing on 6.1.

According to Devel, this is the query that is issued when I search for "site":

SELECT tid FROM term_data WHERE vid IN (3) AND (description LIKE 'ite%' OR name LIKE 'ite%')

But, if I search for "html":

SELECT tid FROM term_data WHERE vid IN (3) AND (description LIKE '%html%' OR name LIKE '%html%')

And if I search for "drupal":

SELECT tid FROM term_data WHERE vid IN (3) AND (description LIKE '0rupal%' OR name LIKE '0rupal%')

I can't believe no one else has already reported this.

Comments

nancydru’s picture

Priority: Critical » Normal
Status: Active » Fixed

I see: if an array is used for substitution, ALL variables must be in it. This needs to be highlighted in the information about switching to db_placeholders.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.