Which king promised God that if he would help him win a certain battle that he would sacrifice the frist thing he saw, which turned out to be his daughter?
You are referring to Jephthah, though he was a judge of Israel and not a king. The story is found in Judges 11. There is an article about the situation that should make what happened clearer. It is called "Jephthah's Daughter."