How to prevent runny nose when eating spicy foods?
Basically you can't prevent this from happening as it is a physiological (part of your body's natural function) reaction to an irritant - in this case the chemical capsaicin in the chili fruit stimulating the trigeminal nerve.  There is such a thing as building tolerance, but I don't know if this will reduce the physiological effects, or just that you have more fun when eating spicy food.

However, there are some things you can do to lessen the effects:

Capsaicin is soluble in oils - which is why it gets taken up very effectively by the tissues in and around the mouth/nose - these parts contain essentially exposed cells covered in a mucus layer. 

If you want to dilute this effect to some extent, you can use products with oils in them. Milk and milk products like yogurt are especially effective  as they contain oils that are very similar to those we have in our cells. This is one of the reasons milk products like Lassi are often served with Indian cuisine. 

Apparently sugar can help too - the sugar undergoes a chemical reaction with the capsaicin and results in a lessening of the heat.