Check if a field value is already in the database I want to check if the entered value is already in the database or not. If it is, I want to stop creating the node, and show a message telling the users to change that value; if that value is not found in the database, the user should be able to create the node. 

What is the correct function to call to stop the creation process?
How do I check if the field value is already in the database?
You should use hook_node_validate
This allows you to return error on the specific field that fails.
e.g.

if($query-&gt;rowCount() &gt; 0) {
  form_set_error('machine_name', t('There already exists another node with same machine name - machine name has to be unique.'));
  // where machine_name is the field in this example
}

You wanna check database if value exists.
Can you elaborate exactly what you wanna check? Is it to ensure a specific field only contains unique values?