I am not surprised. You have three topics going at the same time and are getting different approaches to the problem from various members.
https://www.sitepoint.com/community/t/please-help-me-with-the-code-below/256658
There is good reason cross posting is discouraged.
3 Likes