$z = 1;
$st = $pdo->prepare('SELECT `data` FROM `test` WHERE id=:id');
$st->bindParam(':id', $z);
$st->execute();
$res = $st->fetchAll();
$z = 1;
$a = $pdo->exec('SELECT `data` FROM `test` WHERE `id`='.$z.' ');
This function cannot be used with any queries that return results. This includes SELECT, OPTIMIZE TABLE, etc.