gets plan info from database