Help with checking the input with database

hello
I have a database with one table called Code
I want to check if the input in the text box equals to any of the codes in the table
if yes I want a valid message else invalid