I'm trying to check if company on the frontend already exist then show error message, it checks the email but i want it to also check if a company name on the front end already exists, this is what i have tried, any help is appreciated.
//check if the entered company name already exists in the database
if (!isset($user_data['company'])) {
$user_data['company'] = db_get_field("SELECT email FROM ?:users WHERE user_id = ?i", $user_id);
}
$is_exist = fn_is_user_exists($user_id, $user_data);
//show error message if true
if ($is_exist) {
fn_set_notification('E', __('error'), __('error_user_exists'), '', 'user_exist');
return false;
}