in reply to update and still no output

<broken_record_mode>Use strict and warnings!</broken_record_mode>
(not that it would have caught this problem, but just on general principle it would be a very good idea with this script).

You appear to be attempting to look for a table named 'Device Name' but you are in fact looking for one table named 'Device and another named Name'.