Traditional camera uses film to record images. But for digital camera, the film is replaced by a small sensor chip - either CCD (charged Coupled Device) or CMOS (Complementary Metal Oxide Semiconductor) - which stores the image into a digital format.
The CCD or CMOS sensor's surface is divided into tiny squares called pixels and each pixel records one segment of an image. The more pixels a sensor has, the more details it can record. While it's true that the number of pixels a CCD contains is an excellent measure of the details the digital camera can contain, this is not enough.
Picture quality doesn't necessarily improve with another million pixels. Other features such as lens, colour filter used on the sensor and digital image processor also play an important role in determining picture quality. (See picture below to understand the intricacies of a digital camera in the analogy of a human eye)
To capture an image, lights first have to go through the lens (equivalent to human's eye) which are later gathered as electrical charges by the sensor (equivalent to human's retina). The sensor, by itself, is incapable of perceiving colours, so it obtains colour data via a colour filter arranged above individual pixels. Image data gathered by the sensor is converted into digital signals to be analysed and processed by the image processor (equivalent to human's brain) before recording the image onto a memory card. Each process is crucial in determining image quality.
So don't just be deceived by pixel count. Check for manufacturer's lens and CCD.