Reputation: 91
I have data in my table as below.
1042
1234
1234
.
.
I want to add comma between the numbers like this
1,0,4,2
1,2,3,4
1,2,3,4
.
.
Is there any function to do this in MySQL.
Note: entry in that column is dynamically change. so can not able hardcore the value.
Any idea thanks in advance.
Upvotes: 0
Views: 247
Reputation: 19
You can add this before the entry to the database use below.
$oldstring = 123456;
echo $newstring = implode(",", str_split($oldstring));
//output 1,2,3,4,5,6
Upvotes: 1