Closed (fixed)
Project:
Drupal core
Version:
6.1
Component:
database system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2008 at 16:49 UTC
Updated:
17 Mar 2008 at 17:12 UTC
I have the following test items in my glossary"
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
Comment #1
nancydruI 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.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.