Samuel anoints David as king over Israel in 1 Samuel 16:1-13. It is notable that this comes before David kills Goliath and before he first starts playing the lyre for Saul. In other words, David was already king over Israel before either of those other things happened.
The story of David playing the lyre for Saul comes at 1 Samuel 16:14-23. Now, it is very clear from this passage that Saul had never heard of David ever before.
The story of David killing Goliath comes at 1 Samuel 17; it occupies the whole chapter. Of note is the conclusion:
55 When Saul saw David go out against the Philistine, he said to Abner, the commander of the army, ‘Abner, whose son is this young man?’ Abner said, ‘As your soul lives, O king, I do not know.’ 56The king said, ‘Inquire whose son the stripling is.’ 57On David’s return from killing the Philistine, Abner took him and brought him before Saul, with the head of the Philistine in his hand. 58Saul said to him, ‘Whose son are you, young man?’ And David answered, ‘I am the son of your servant Jesse the Bethlehemite.’
So, according to this story, Saul had never heard of David before.
On the one hand, let’s assume the events occurred in the order they appear in the text: Saul first met David when his servants recruited David to play the lyre for him. In that case, how could it be that as of 1 Samuel 17:58, Saul doesn’t know who David is?
On the other hand, let’s assume the text reports the events in reverse order: Saul first met David when David killed Goliath. How then can it be clear from 1 Samuel 16:14ff., that when David began playing the lyre for Saul, Saul had never met him before?
Neither one of the two events can have happened first.