stefan_weiss
Posts: 4
|
| Posted: 05/04/2010, 12:55 AM |
|
Hi,
im currently using CCS 4.2.00.040, PHP5, MySQL5
I have created a small Project. At first i wanted to use MySQL Fulltext Search, but in this case it is not the right solution. No i've made a Grid and a Searchform.
In the Before Execute Select i inserted this code:
global $hmdbSearch;
$tmpvar = $hmdbSearch->s_name->GetValue();
if(strlen($tmpvar)){
$hmdb->DataSource->SQL="
SELECT * FROM hmdb
WHERE
name LIKE '%".$tmpvar."%'
OR format LIKE '%".$tmpvar."%'
OR title LIKE '%".$tmpvar."%'
OR keywords LIKE '%".$tmpvar."%'
OR description LIKE '%".$tmpvar."%'
";
echo $hmdb->DataSource->SQL;
}
the generated SQL lokks like this:
SELECT * FROM hmdb WHERE name LIKE '%pal%' OR format LIKE '%pal%' OR title LIKE '%pal%' OR keywords LIKE '%pal%' OR description LIKE '%pal%'
The generated CCS php code returns this error:
Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE name like '%pal%' LIMIT 0,20' at line 8
I tried to use this generated SQL in phpMyAdmin - ist works without any error. I tried it in a very small php-script - ist works without any error.
Whats wrong?
Regards
Stefan
|