To prevent occurances like this I use a pill box. I need the one with 4 compartments per day, each day removable so I can take it with me if I go out.
I ALSO keep a log/journal! I write in what time I take each pill, even vitamins, plus pain levels,
location of pain if relevant, like mine is now after 2 abdominal surgeries only a week apart. I write down what I eat and drink, reactions to foods and meds. It's made for good information for my doctors! I go back through it before visits. Much better than relying on memory, which is unreliable without being messed up with meds!