How do you know?
Your browser says there is no connection.
The router gives you an IP that starts with 169.X.X.X which means it hates you and won't allow you to use the internet.
This happens very often to me, especially if the router has been turned on non-stop for weeks or months. So the solution which I know most of us will do is reboot the router. That almost always solves the problem.
The problem is on public WiFi. It's a little more difficult to get the owner of the establishment to reboot the router. I tried this at my local mamak shop and the worers reply is that "Sorry. Boss takde. Tak tahu camner nak tutup and on balik router".
Example. Here's my settings:
The 188 is abitrary. You can choose any number between 1-255 except '1' because usually the router takes that IP number.
Advantage is pretty clear. Since no one else is connected except me, I have the internet all to myself :)
My usual snack while getting my internet fix at my mamak shop.