Re: set_sql and like '%$searchTerm%'
[prev]
[thread]
[next]
[Date index for 2004/09/15]
Ah ha!
So it looks like it was working in some of the cases the way I was
doing it. That is weird.
Passing in with placeholders makes it work all the time now. NICE!!!!
THANK YOU !!!
-Michael
On Sep 15, 2004, at 10:25 AM, Perrin Harkins wrote:
> On Tue, 2004-09-14 at 16:03, Michael Jensen wrote:
>> Table::Files->set_sql(full2a_srch => qq|select f.* from files f, texts
>> t where (f.user_id=$filesUserID AND f.id=t.file_id AND (f.file like
>> "%$searchTerm%" OR t.line_1 like "%$searchTerm%" OR t.line_2 like
>> "%$searchTerm%" OR t.line_3 like "%$searchTerm%" OR t.body like
>> "%$searchTerm%")) order by create_date desc limit $p,$limit|);
>>
>> my @list2aQuery = Table::Files->search_full2a_srch();
>
> This doesn't look like it should work at all. The set_sql call happens
> at compile time, when $searchTerm probably has no value. You are
> supposed to do this kind of thing with placeholders, and pass the value
> in when you call search_full2a_srch().
>
> - Perrin
>