[development] module dev. mysql like operator problem.

Thomas G. Willis tom.willis at gmail.com
Mon Nov 28 15:24:50 UTC 2005


I bet it's escaping the percent sign. anyone know of a way to control that?

I'm doing this on the cvs version forgot to mention that?


On 11/28/05, Justin Davies <justin at buddyping.com> wrote:
>
> Thomas,
> Not a huge amount of help, but may give you some pointers:
>
> Get the devel module and turn on query output.  You will be able to see
> exactly what is being sent to the database.
>
> The other thing is that db_query *might* be escaping the % character so it
> will never return a result unless you have an artist starting with A%.
>
Justin
> --
> t: CEO/CTO buddyPing
> e: justin at buddyping.com
> m: 07833 530876
>
>
> On 28 Nov 2005, at 14:44, Thomas G. Willis wrote:
>
> I apologize if this isn't the right list. didn't know if this would be
> support necessarily since it's a custom module.
>
> I'm at a loss as to whether this is a bug or whether I'm just trying to do
> something I'm not supposed to.
> I can't get a query working using the like operator in drupal. the same
> sql runs fine in in phpmyadmin.
>
> not like will return results though weird. any ideas?
>
>
> function _db_getartistlist($filter=''){
> //Example $filter='A%';
> /*filter not working yet ??*/
>
> /*doesn't work*/
> /*
>    if($filter!=''){
>       return db_query('select distinct artist from {mp3col_data} where artist like \'' .$filter . '\' order by artist');
>
>       //return db_query('select distinct artist from {mp3col_data} where artist like \'%s\' order by artist',$filter);
>
>    }else{
>       return db_query('select distinct artist from {mp3col_data} order by artist');
>
>    }
> */
>
>    /*works*/
>    return db_query('select distinct artist from {mp3col_data} order by artist');
> }
>
>
>
> --
> Thomas G. Willis
> -----------------------------------------------
> http://i-see-sound.com
> http://tomwillis.sonicdiscord.com
>
>
>
>


--
Thomas G. Willis
-----------------------------------------------
http://i-see-sound.com
http://tomwillis.sonicdiscord.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20051128/c8b51a76/attachment.htm


More information about the development mailing list