db_set_active('mydatabase'); $query = db_select('mytable', 'c'); $query->fields('c', array('number','email_address')) ->condition('number', $phoneval, '=') ->condition('mail', $mailval, '='); $result = $query->execute()->fetchAll(); You could use nested if if (empty($result)) { // do print_r($result); // here you will get in array if (empty($result[0])) { form_set_error('phone_number','We have no record of that Assessment Number'); } else if(empty($result[1])) { form_set_error('mail','We have no record of that email'); } }