Added support for writing barcodes to database
Bugfixes

Fix syntax of foreach loop
Move stmt->close() so that the statement remains open for future iterations