iPhone 3g with IOS 4.2.1 cycles wifi, cannot connect
Eliminate the possibility of a software problem by (first backing up and then) restoring to a clean default OS install. It you still can't connect in that state, it's time for a visit to the Genius Bar or a call to AppleCare.