David's response to Achish was deliberately ambiguous. He did not promise to fight for the Philistines but gave the impression he would (v. 2). Achish interpreted David's words as a strong commitment to him and rewarded David with a position as his bodyguard for life.
David continued to be a blessing to Israel as he obeyed God in Ziklag without giving any real help to Israel's enemy, the Philistines. This plan of David's, while yielding some positive benefits, involved him in deception and lying plus leaving him vulnerable to Achish if the Philistine king had learned what was really happening.
This whole pericope illustrates that when opposition from ungodly people persists God's people should continue to pray and to trust Him for protection rather than taking matters into our own hands. If we initiate a plan without seeking God's guidance, we may remove one source of aggravation and danger only to find ourselves in another. Such plans may result in some good, but they may also put us in situations where we find it even more tempting to disobey God (cf. Jacob). We should, instead, remember God's promises (e.g., 1 Pet. 1:3-9; 2 Pet. 1:2-4) and pray for His guidance (cf. Phil. 4:6-7).