I'm glad you got it to work out. Just for any others that come across this it is not the '$AddToWhere' part of the code but the query code you see just after this.
I will keep an eye out for your other thread.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.