How can i fetch the value from database in a simple module? I'm working in drupal 7 and I have tried all help but not able to fetch the value from database.

    function myModule_load($node){

    $result = db_query("SELECT * FROM {uc_auction_bids} WHERE nid = :nid", array(':nid' =&gt; 258,)); 
$record = $result-&gt;fetch(); 

    // print the fields/values of $record 
print('&lt;pre&gt;'); print_r($record); print('&lt;/pre&gt;');


and also

    function myModule_block_view($delta) {    
       if (($node = menu_get_object()) &amp;&amp; ($node-&gt;type === 'product')) {
        $results = db_query("SELECT * FROM {uc_auction_bids} WHERE nid = :nid", array(':nid' =&gt; $node-&gt;nid));
        $records = $results-&gt;fetchAllAssoc('bid');

        $content = ... // Format records here...

        return array(
          'subject' =&gt; t('Bids'),
          'content' =&gt; $content
        );   } }


I want to fetch the value in module and in the page, but not at the top of the drupal header
Something like this should work:

/**
 * Implements hook_block_view
 */
function MY_MODULE_block_view($delta = '') {

  if (($node = menu_get_object()) &amp;&amp; ($node-&gt;type == 'product')) {      
    $query = db_select('uc_auction_bids', 'bids');
    $query-&gt;fields('bids');
    $query-&gt;condition('nid', $node-&gt;nid);
    $result = $query-&gt;execute()-&gt;fetchAllAssoc('bid');

    // Debug
    drupal_set_message('&lt;pre&gt;'.print_r($result,1).'&lt;/pre&gt;');

    $content = ''; // Format records here...

    return array(
      'subject' =&gt; t('Bids'),
      'content' =&gt; $content
    );   
  } 

}