How to get node ID from drupal 7 when i know title (title shouldnt be duplicated) Drupal
As suggested by Mołot you can do this with EntityFieldQuery.

// Initialize EntityFieldQuery.
$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node');  

$query-&gt;propertyCondition('title', "My title", "=");


// Execute query and collect results
$result = $query-&gt;execute();  

$nids = array();
if (isset($result['node'])) {
  $nids = array_keys($result['node']);
}


In the example $nids will be an array with all node ids that have the title "My title". Entity field query really helps you when the query gets more complicated. You don't have to do joins for example yourself but can instead do something like $query->fieldCondition('field_news_types', 'value', 'spotlight', '=') which using db_select would require joins on tables.