To properly "glue" (it's actually a chemical welding process) PVC pipe TO A FITTING (i.e. you can't "glue" two pieces of pipe together, you have to "glue" the two pipes together with a fitting), you first mechanically clean the outside of the pipe and the inside of the fitting that will go over the pipe. You then use a
PVC Primer on the outside of the pipe and inside of the fitting. Once the primer has dried, you place a thick coat of
PVC Cement on the outside of the pipe and a thin coat of the cement on the inside of the pipe. You push the two ends together and give it atleast a quarter turn to help ensure the cement is distributed all around the pipe to ensure you have a complete seal.
BTW, the pipe and fitting should have a snug fit when you put them together "dry" (before using the cement). If you sand the pipe too much, the diameter of the pipe relative to the fitting can be off so much that the join will fail.