Corrected binding
Formatted code, and updated comment
Updated query logic to ensure no duplicate data can be added to the database