There is a lot of custom code and commented out code on this page. I think we would have to do a screen sharing session with a premier support ticket to hash this out and find a solution.
If $value is set correctly as an array, then it might be as simple as using:
$ReplaceQuery->bindColumn("DetailItems", "s", $value, "WA_DEFAULT");
But I'd have to do debugging and work through everything up to that point to be confident. I don't think I can do all that in the context of a forum post.