Load all node titles with db_query() $title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", 1));


with this code i can get title from node with id == 1. But how can i load all node titles with specific content type?

$title = db_result(db_query('SELECT title FROM {node} WHERE type = %s', $content_type));


Please correct my code to get all node titles from specific content type and how to limit them by 20 items for example?
$result = db_query_range("SELECT title FROM {node} WHERE type = '%s'", $content_type, 0, 20);
$titles = array();
while ($row = db_fetch_object($result)) {
  $titles[] = $row-&gt;title;
}


http://api.drupal.org/api/drupal/includes--database.inc/group/database/6