Not sure if you're using an android device or using an apple device but If you have an android device and it is not staying connected to WIFI try this first.
Tap the Menu button on your android device.
Tap Wireless and Networks.
Tap Wi-Fi settings.
Tap the Menu button again.
Tap the Proxy setting and make sure your Android device is not set up for a Proxy.
If that doesn't fix it then make sure that your mobile internet is not on.
I also found that my android device would not stay connected to wifi if I also had the mobile internet set to on.
It would always turn WIFI off and then try and connect to mobile data instead.
So I had to always make sure that the mobile data was turned off when near a WIFI source and when I wanted to use WIFI instead.
If it's an apple device I'm not sure since I don't own any apple devices but maybe someone else will know.