For displaying query you can use dpq() function and to display print result dpr()

Example 



  $query = db_select('users','u');
  $query->fields('u');
  $query->condition('u.uid',1042);
  $result = $query->execute()->fetchAll();

  dpq($query); // For Displaying Query 
  dpr($result); // For Displaying Query results