I think you are saying you never know whether user inputs Firstname or Lastname. In that case you need seperate queries to match firstname and lastname. If user enters firstname go for one query else go for the other.
where first_name='vamshi' OR last_name='g'
using this would give you all the matching rows either firstname or lastname thats may not what you want.