storing search query in database

-working on checking if search term and key match
-if they match then not to insert a new row but to update an existing
row with user ids