Split variable from database

Hi this is what the problem is:

I have variable “newsText”
“newsText” = a row of numbers like this:
2
3
4
5
Now I want to split this row of numbers(so that they will look like this 2,3,4,5) i tried it this way:

 [font=Courier New][color=#ff8000]str_arr = newsText.split("
"); [/color][/font]

This works well when i’m using it offline but the fact is that the variable “a” is comming from a database. Therefor this script aint working.
Here is de webpage where I’m trying it…
http://www.nearestneighbour.net
The first row of numbers is “newsText”
The second row is “str_arr” already gone through the script i added above.
I added the files I’m working on hope someone can help me.