There is a process to gluing PVC piping and plumbing fittings together. PVC piping is very common in landscaping and so you will likely be working with it outdoors. Whether you are adding a valve or additional sprinklers, or maybe you have an underground leak, look for the PVC.
When you are connecting PVC to a fitting, cut the pipe squarely. Cutting the pipe squarely will make it so that the entire circumference of the pipe bottoms out against the fitting’s internal stop.
Prime both the outside of the pipe and the inside of the fitting and let that dry. Purple primer makes it so that you can easily see when it has dried. It dries very quickly and is flammable so be careful with it and the glue. When the primer has dried, apply glue to the exterior of the pipe and the interior of the fitting. Push the two together until they bottom out, and give a slight turn. Make sure that the fitting is oriented where you want it because you will not be able to get the two apart. The glue locks the pieces together, and after a few seconds you won’t be able to pull them apart. Read the label on the glue for the length of time you must wait before you can turn the water back on.