Remove commas using php from mysql

*爱你&永不变心* 提交于 2021-02-05 12:15:18

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!