Fetch all item names in one query

Do not hammer the database with queries, but fetch them all in one row (untested)
Additional fixes
Uppercase class names
Do not modify superglobals
Merge pull request #2 from mbek/patch-2

Fetch all item names in one query