My iPhone 3G won't receive data (using WiFi)

This means that the device was unable to get an IP address via DHCP. The router may need to be rebooted itself, or it may not be set up to hand out IP information via DHCP and your iPhone will have to be set up statically. Check with the administrator of that wifi network for exact details. If it's your own, double check DHCP is enabled for your router, and if so, perform a hard reboot of the device.

Additionally, it never hurts to reboot your iPhone as well.

Should the problems persist, there may be a problem with the phone software or hardware. Restore the operating system on the phone, and try again. Should it still fail, my suggestion would be to take it to some Apple authorized repair depot for diagnostics.