I have a little problem that i can't explain :
I have my query working with pdo in php like this :
$table = "Potatatoe";
$sql = $pdo->prepare('SELECT * FROM EATABLES WHERE FOOD = ? ');
$sql->execute(array($table));
$data = $sql->fetchAll(PDO::FETCH_ASSOC);
var_dump($data);exit;
The vardump will return some datas.
But my problem is i have an array of tables
$tables = array("T_tab1", "T_tab2", "T_tab3", ..);
And i would like to run a query SELECT * FROM [eachtable in the array] So i have :
$sql = $pdo->prepare('SELECT * FROM ? ');
$sql->execute(array($table));
$data = $sql->fetchAll(PDO::FETCH_ASSOC);
var_dump($data);exit;
with $table which is from an foreach on $tables
So why i can't have something like this "SELECT * FROM ?" with ? equals to a string ?
Any help would be appreciated !