I found the solution after going through many many sites and getting nothing then coming back and combing through this one and finally finding the solution lol, I had to adapt it a bit but it works:
Now I'm still not quite sure, I mean I'm glad it works but I'ld like to understand the code. why is there a slash here \"{$data[clientId]}\" ....or is it a combination fo the \ and " that allows a quote to be used without interrupting the code? I understand the rest just not that bit.