Unless the iPhone has been jailbroken, there is not virus that can affect it. There is no anti-virus software available, either.
Have you worked through the steps and tips in http://support.apple.com/kb/TS1398 to see that the WiFi and iOS are working together properly? When you do the step of cycling the router, you need to disconnect power to the router so it is fully shutdown...some do not shutdown with the power button but go into standby mode. The router has to shutdown completely and then restart and acquire a new starting IP address for the DCHP daemon.