[development] module dev. mysql like operator problem.
Justin Davies
justin at buddyping.com
Mon Nov 28 15:17:44 UTC 2005
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20051128/f7ad3a10/attachment.htm
More information about the development
mailing list