breastfeeding help

July
With my first three I tried to breast feed and developed mastitis each time within a week or two. Not sure why it happened, if I was doing something wrong or not. Doctor didn't have any good advice and the La ale he consultant just made me feel worse by saying I wasn't trying hard enough. I tried to pump but it was just too infected. Unfortunately I'm not sure me and baby knew what we were doing. Lol. Has this happened to anybody use? Any suggestion or recommendations so I can successfully breast fed this time around?