Use the loop to check if DB record exists?

Use the loop to check if DB record exists?