your query is working, it's just not returning any results hence when you try to loop through them you get that error. Just echo the query onto the page then paste it into your SQL editor to tweak it and find out what's wrong. If I had to guess I'd say your item_types table IDs don;t match the ones in your items table if you're using the same structure I suggested