updated mysql queries & search