escapeSQL inserting double single quotes

If I put in the escape sql, it wont work properly. if I leave it out, like I did in the code posted it all works fine. So I am not sure if it is getting done in another place also.