Method to get user information (OOP / MVC approach)
What you have isn't really a function to search for a user, but a function to get a user, either by id or by name. 

So instead of having one function that does two different things, why not have two functions?

public function getUserById($db_con, $id){
    $queryGetUser = $db_con-&gt;prepare('SELECT * FROM users WHERE user_id=:id');
    [...]
}

public function getUserByUsername($db_con, $username){
    $queryGetUser = $db_con-&gt;prepare('SELECT * FROM users WHERE user_username=:username');
    [...]
}


Now you don't have to pass empty strings to the function (which is really confusing to use), and the functions have a proper name as well.