Skip to main content
added 2 characters in body
Source Link
David Thomas
  • 21.9k
  • 2
  • 33
  • 68

Something like:

$query = db_select('tablename');
$query->fields('tablename', array('field1'field1', field2''field2'));
$query->condition('field3', $var1);
$query->condition('field4', $var2);
$query->orderBy('field1', 'DESC');

$result = $query->execute();

foreach($result as $row){
  // Debug
  drupal_set_message('<pre>'.print_r($row,1).'</pre>');
}

More info:

Something like:

$query = db_select('tablename');
$query->fields('tablename', array('field1, field2'));
$query->condition('field3', $var1);
$query->condition('field4', $var2);
$query->orderBy('field1', 'DESC');

$result = $query->execute();

foreach($result as $row){
  // Debug
  drupal_set_message('<pre>'.print_r($row,1).'</pre>');
}

More info:

Something like:

$query = db_select('tablename');
$query->fields('tablename', array('field1', 'field2'));
$query->condition('field3', $var1);
$query->condition('field4', $var2);
$query->orderBy('field1', 'DESC');

$result = $query->execute();

foreach($result as $row){
  // Debug
  drupal_set_message('<pre>'.print_r($row,1).'</pre>');
}

More info:

Source Link
David Thomas
  • 21.9k
  • 2
  • 33
  • 68

Something like:

$query = db_select('tablename');
$query->fields('tablename', array('field1, field2'));
$query->condition('field3', $var1);
$query->condition('field4', $var2);
$query->orderBy('field1', 'DESC');

$result = $query->execute();

foreach($result as $row){
  // Debug
  drupal_set_message('<pre>'.print_r($row,1).'</pre>');
}

More info: