So he sent messengers, saying to them, "Go consult Baal-Zebub, the god of Ekron, to see if I will recover from this injury."Whenever I read this passage, I keep hoping that the king will say, "D'oh! Let me inquire of a prophet of the Lord instead!" But the words don't change; no matter how many times I read it, Ahaziah always does the same thing: he sends a captain with 50 men to arrest Elijah. When they are all killed, he sends another captain with another 50. And another.But the angel of the Lord said to Elijah the Tishbite, "Go up and meet the messengers of the king of Samaria and ask them, 'Is it because there is no God in Israel that you are going off to consult Baal-Zebub, the god of Ekron?' Therefore this is what the Lord says: 'You will not leave the bed you are lying on. You will certainly die!'" So Elijah went.
from 2 Kings 1
When Ahab heard these words, he tore his clothes, put on sackcloth and fasted. He lay in sackcloth and went around meekly. Then the word of the Lord came to Elijah the Tishbite: "Have you noticed how Ahab has humbled himself before me? Because he has humbled himself, I will not bring this disaster in his day, but I will bring it on his house in the days of his son."But Ahaziah didn't, and more's the pity.1 Kings 21.27-29