Closed (fixed)
Project:
Flexinode
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Apr 2005 at 18:47 UTC
Updated:
6 Oct 2005 at 22:20 UTC
Searching a flexinode text field and including a ' in the query causes an SQL error similar to the following:
You have an error in your SQL syntax near 's grill%'OR
Where the search was: fred's grill
This is easily fixed by replacing ' with '' in the flexinode_page_table function:
Change:
if ($edit['search']) {
$sql .= " AND (n.title LIKE '%". $edit['search'] ."%'";
foreach ($ctype->fields as $field) {
$sql .= 'OR flexinode_'. $field->field_id .".textual_data LIKE '%". $edit['search'] ."%'";
}
$sql .= ')';
}
To:
if ($edit['search']) {
$qsearch = str_replace("'", "''", $edit['search']);
$sql .= " AND (n.title LIKE '%". $qsearch ."%'";
foreach ($ctype->fields as $field) {
$sql .= 'OR flexinode_'. $field->field_id .".textual_data LIKE '%". $qsearch ."%'";
}
$sql .= ')';
}
However, this is almost certainly not the 'Drupal way' to do this - if anyone knows exactly which filter function this string needs to be run through to do this, please advise!
Thanks!
- Grugnog
Comments
Comment #1
mfbThis appears to have been fixed in current CVS of flexinode.
Comment #2
(not verified) commentedComment #3
(not verified) commentedComment #4
(not verified) commentedComment #5
(not verified) commentedComment #6
(not verified) commentedComment #7
(not verified) commentedComment #8
(not verified) commentedComment #9
(not verified) commented