[support] Drupal 5 db_query

bharani kumar bharanikumariyerphp at gmail.com
Mon Sep 22 17:43:51 UTC 2008


Why you are using mysql in that ??

I thing that also is the error



On Mon, Sep 22, 2008 at 4:36 PM, Fred Jones <fredthejonester at gmail.com>wrote:

> Here is some trivial code:
>
> $n= db_query($countsql) ;
> echo "<!-- ";print_r(db_fetch_array($n)); echo " -->";
> $countsql = str_replace('{','',$countsql);
> $countsql = str_replace('}','',$countsql);
> $resultXXX = mysql_query($countsql);
> echo "<!-- ";print_r(mysql_fetch_array($resultXXX)); echo " -->";
>
> which runs my $countsql through db_query, shows the result and then
> through mysql_query and shows the results. The two other lines just
> remove the { and } characters. I would have expected to see the same
> results both times, but what I see is:
>
> <!-- Array
> (
>    [COUNT(*)] => 0
> )
>  --><!-- Array
> (
>    [0] => 4
>    [COUNT(*)] => 4
> )
>  -->
>
> The mysql_query version returns the correct result--that is what I see
> if I run the query via phpMyAdmin as well. Seems that Drupal's
> db_query is doing something to it. The operative issue is the use of
> UCASE I am quite certain. I wanted to make my LIKE phrase case
> insensitive, so I added UCASE to both sides of it, but now db_query
> fails.
>
> Anyone have any feedback on this? I would not be opposed to just using
> mysql_query but the query in question I actually want to pass to
> pager_query, which in turn of course passes it to db_query.
>
> Thanks.
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080922/776436e4/attachment-0001.htm 


More information about the support mailing list