Zahir Alam
Zahir Alam

Reputation: 13

Remove commas using php from mysql

i have a column name fighters which include some value in mysql such as,

| fighters |

| Rock |

| John Cena, |

| UnderTaker,|

So, I want when i Display it in a browser it should appear like

Rock

John Cena

UnderTaker

I just want to remove commas from database using PHP

Any Help will be appreciated..

Upvotes: 0

Views: 980

Answers (2)

Dave
Dave

Reputation: 3288

Use REPLACE() in the SQL query

SELECT REPLACE(fighters, ',', '') FROM  table 

Though why you'd want to do this in query rather than stripping it on the php side if beyond me

Upvotes: 2

chandresh_cool
chandresh_cool

Reputation: 11830

Give

str_replace(",","",$str);

Upvotes: 3

Related Questions