Mostly we have wrong knowledge of Pixels and Resolution. They are related to each other but are completely different.
As pixels are the smallest box of any photo and when lots of pixels mix together they form a area which is commonly known as photo. More the number of pixels the the photo quality.
Resolution is the ratio of hight and width on which pixels density stands. As more the resolution more the quality and more pixels. As we see this, we have HD, FULL HD ULTRA HD, 2K, 4K, or even 8K resolutions.
In short resolution is the size and pixels are the part of that size.