This Bible contradiction is from the Skeptic's Annotated Bible.
Before David slew the Philistine.
1 Samuel 16:21-23 View context
And David came to Saul, and stood before him: and he loved him greatly; and he became his armourbearer.
And Saul sent to Jesse, saying, Let David, I pray thee, stand before me; for he hath found favour in my sight.
And it came to pass, when the [evil] spirit from God was upon Saul, that David took an harp, and played with his hand: so Saul was refreshed, and was well, and the evil spirit departed from him.
After David slew the Philistine.
1 Samuel 17:55-58 View context
And when Saul saw David go forth against the Philistine, he said unto Abner, the captain of the host, Abner, whose son [is] this youth? And Abner said, [As] thy soul liveth, O king, I cannot tell.
And the king said, Enquire thou whose son the stripling [is].
And as David returned from the slaughter of the Philistine, Abner took him, and brought him before Saul with the head of the Philistine in his hand.
And Saul said to him, Whose son [art] thou, [thou] young man? And David answered, I [am] the son of thy servant Jesse the Beth-lehemite.