I can't fetch anything else than '1' to my PDO query Here is my PDO request :

$query = db_select('review_ratings_table')
   -&gt;fields('review_ratings_table',array('review_nid'))
   -&gt;condition('loc_id', $loc_id, 'LIKE')
   -&gt;condition('user_id', $user_id, 'LIKE')
   -&gt;condition('valid', '1', '=')
   -&gt;execute();
while($record = $query-&gt;fetchAssoc()) {
 drupal_set_message('&lt;pre&gt;test '.print_r($record).'&lt;/pre&gt;');
}


I have tried many ways to get the result of this request (fetchAll, fetchField, fetchAssoc ...) and I keep printing "1" instead of the review_nid or anything else.

Thanks for you help.

Will 

=> Hi,
If I use dvm($query) I get that : 


  DatabaseStatementBase::__set_state(array(
     'dbh' => 
    DatabaseConnection_mysql::__set_state(array(
       'needsCleanup' => false,
       'target' => 'default',
       'key' => 'default',
       'logger' => NULL,
       'transactionLayers' => 
      array (
        'drupal_transaction' => 'drupal_transaction',
      ),
       'driverClasses' => 
      array (
        'SelectQuery' => 'SelectQuery',
        'DatabaseTransaction' => 'DatabaseTransaction',
      ),
       'statementClass' => 'DatabaseStatementBase',
       'transactionSupport' => true,
       'transactionalDDLSupport' => false,
       'temporaryNameIndex' => 0,
       'connectionOptions' => 
      array (
        'database' => '*******',
        'username' => '*******',
        'password' => '*******',
        'host' => 'localhost',
        'port' => '3306',
        'driver' => 'mysql',
        'prefix' => 
        array (
          'default' => '',
        ),
      ),
       'schema' => NULL,
       'prefixes' => 
      array (
        'default' => '',
      ),
       'prefixSearch' => 
      array (
        0 => '{',
        1 => '}',
      ),
       'prefixReplace' => 
      array (
        0 => '',
        1 => '',
      ),
    )),
     'queryString' => 'SELECT review_ratings_table.review_nid AS review_nid
  FROM 
  review_ratings_table review_ratings_table
  WHERE  (loc_id LIKE :db_condition_placeholder_0 ESCAPE \'\\\') AND (user_id = :db_condition_placeholder_1) AND (valid = :db_condition_placeholder_2) ',
  ))


and


  Error message
  Recoverable fatal error: Object of class DatabaseStatementBase could not be converted to string in review_ratings_table_node_presave() (line 52 of C:\Bitnami\drupal-7\apps\drupal\htdocs\sites\all\modules\custom\review_ratings_table\review_ratings_table.module). 


and

dvm($query->fetchAssoc()); gives me that


  array(
    'review_nid' => '2',
  ) 


Which is what I want but I don't know how to access it.

Thanks
With drupal_set_message('&lt;pre&gt;test '.print_r($record).'&lt;/pre&gt;'); you're putting the return value of print_r into a string, not printing the contents of $record.

You can acccess the value you need with:

$result = $query-&gt;fetchAssoc();

// make sure we found something
if (empty($result) || empty($result[0]['review_nid'])) {
  dpm("No result");      
}

// load the noad we found
$node = node_load($nid)
dpm($node);