question about position of objects

I am creating several cubes which is right next to each other using GL_QUAD, i.e. a side of the cube would share the same location in the 3d world. My code has problem determining which cube is in front of which in the case where 2 cubes have sides that share the same position in the 3d world. Is there a way that I could tell openGL which cube is in front of which??
Any help would be appreciated.

here is the ss http://hk.f2.pg.photos.yahoo.com/ph/innonetz/album?.tok=ph_eXuABQHvp4o8Z&.dir=/48ae&.src=ph

I was setting the zNear too close to zero.