in reply to Mysql - prepare

Is it not possible to use a ? for a table name

Bingo. The reason is the bound value, being a character string, will be inserted into the sql as 'table_name', enclosed in single quotes. As you can see, select * from 'table' ... isn't going to do what you want.

---
It's all fine and dandy until someone has to look at the code.