[support] Error when execute query

Buddhika Laknath blaknath at gmail.com
Sun Feb 14 18:49:06 UTC 2010


This is because of this line of code.

$block['content'] = $alphabetical_search_result;

Where your $alphabetical_search_result is a mysql result resource object 
and Drupal expects instead a string.

Change the above line to something like this.


while ($line = db_fetch_object($alphabetical_search_result){
    $block['content'] += $line->some_text_feild_in_database;
}

-Laknath

bharani kumar wrote:
>
>
> Hi i got error
>
> recoverable fatal error: Object of class mysqli_result could not be 
> converted to string in 
> F:\wamp\www\vijaishopping\themes\garland\block.tpl.php on line 10.
>
>
> Hi i tried custom module, it through the error ,
>
> What i do now,
>
> my snippet below
>
> <?php
>
> function alphabeticalsearch_block($op = 'list', $delta = 0, $edit = 
> array()){
>
>      if($op == "list") {
>             $block = array();
>           $block[0]["info"] = t('Alphabetical Search');
>         return $block;
>       }
>   elseif($op == 'view'){
>     $alphabetical_search_result = db_query("SELECT node.nid AS nid, 
> node.title AS node_title,   node_revisions.body AS node_revisions_body,
>               node_revisions.format AS node_revisions_format FROM node 
> node LEFT JOIN node_revisions node_revisions
>               ON node.vid =    node_revisions.vid where node.title 
> like '%a'");   
>        
>      $block['subject'] = 'Click to send request';
>      $block['content'] = $alphabetical_search_result;
>     return $block;
>   }
>
> }
>
>


-- 
I blog at http://mytechgossips.com



More information about the support mailing list