Bring it to your carrier or an independent repair shop and try it on their wifi. (They may not let you have the phone while they're connecting to their wifi, so you can't get their password, but they'll tell you whether it connects or not.)
If it's not connecting to anything, and it's a new (new enough to be under warranty) phone, that's a defect that's covered. If not, you're going to have to decide whether a repair is worth the price - it may not cost much more to buy a new phone.