Prova ad aggiungere prima di quella riga
Codice PHP:
print_r($db); 
e dimmi che ti esce fuori...