The P228 is the older of the two and was designed around the 9MM round; the newer P229 was originally built to handle the .40 S&W round.
The P228 has a stamped slide with a welded on frontpiece and a pinned in (and removable) breechblock. Depending on its finish (and how well it’s taken care of), the slide can be somewhat rust-prone. The slide has full-length serrations. The breechblock is pinned in the slide with two roll pins – one inside the other – which also capture the firing pin. It has an internal extractor
The P229 has a heavier, milled, stainless (though sometimes blackened) slide. The slide has only half-length serrations. The equivalent pin to the roll pins in the P228 is solid. It has an external extractor.
AFAIK, the P228 is not available with a rail.
The P228 is slightly lighter and less chunky than the P229. Thus, for a 9MM I much prefer the P228. It just handles a bit better IMHO.