My script containing that error is this:
$stmt = $this->db->prepare(\'SELECT libelle,activite,adresse,tel,lat,lng FROM etablissements where type IN (\'
Your db object is null. Check if you close the connection too early or somehow you override it to null.