That's usually a router problem (it's called a limited connection). It can be difficult to fix, even for someone who's there. Read
[GUIDE] Troubleshooting Wi-Fi Connection Problems and try the suggestions there. Also try to find your DHCP server (in the router, when you're connected to it) and make sure that the "range" (or the number of allowable connections" allows for at least one more connection.
You have one connection from the phone (or computer or laptop) to the router - and another connection
for that device from the router to the internet. Bear that in mind as you're troubleshooting. You can connect to the router, but not get a connection through the router to the internet - and the only way you'll know is that the phone can't connect to places on th internet. As far as the phone is concerned, it's "connected".
(Choosing a static IP means that you must choose one that's in the same subnet as the router itself - if the router's IP address is 10.0.0.1 and you choose 192.168.1.1 for the phone, you'll
never get a connection. It's normally not a good idea to choose a static IP.)
BTW, if you have, say, 5 "slots" available in the DHCP server, and you try to connect 6 devices, the 6th one to connect will get a limited connection. Unless you always bring things up in the same order, that limited connection device is going to be different all the time. That can drive you mad, unless you realize that this kind of problem always means that you're one slot short of the number you need.