I created a custom module where I am querying the database, for example with code similar to the following one.
$query = db_select('node', 'n');
$query->fields('n', array('nid'));
$nid = $query->execute()->fetchField();
I want to print the warning, error, and success messages after the execution of the query. How can I achieve this?