Like this my query is working fine:
$pdo = $db->prepare('SELECT *
FROM projects WHERE project_id = :project_id ');
$pdo->execute(array('project_id' => $project_id));
while ($row = $pdo->fetch(PDO::FETCH_ASSOC)) {
echo "ok";
}
But when I add a subselection then I get a blank page:
$pdo = $db->prepare('SELECT *
(SELECT * FROM animals WHERE projects.animal=animals.id) AS animal
FROM projects WHERE project_id = :project_id ');
$pdo->execute(array('project_id' => $project_id));
while ($row = $pdo->fetch(PDO::FETCH_ASSOC)) {
echo "ok";
}
What did I do wrong?