问题
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..
回答1:
Give
str_replace(",","",$str);
回答2:
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
来源:https://stackoverflow.com/questions/16231080/remove-commas-using-php-from-mysql