Hi,
i don't see to much fundamentally wrong with your approach. (But then again, 'I ain't no pro').
Looks like your queryis wrong.
Echo the query srting. And you place quotes around the tablename. You do not need them (Might even be the problem??)
J.
PS: next time paste this error with it directly: Saves a lot of people going through your code. this points directly to the area of problem.)