mi sembra che tu abbia un pò di confusione in testa

Codice PHP:
$q $db->query($sql);
$res $q->fetchAll();
echo 
$res['login'];