开发者

Remove certain symbol from insert

开发者 https://www.devze.com 2023-03-26 10:43 出处:网络
I would like to remove the symbol ° from a field that\'s to be inserted into my database. Now I already have Format::Strip_tags on my field.

I would like to remove the symbol ° from a field that's to be inserted into my database. Now I already have Format::Strip_tags on my field.

开发者_运维问答

How can I get the value ° from the field to be changed with #? The symbol ° gives error and when I check my MYSQL database, I get this:

Connection: utf8_general_ci

Database: latin1_swedish_ci

Server: latin1_swedish_ci


In PHP:

str_replace('°', '#', $yourString)


You could use the REPLACE funciton:

INSERT INTO YourTable
    SELECT REPLACE(YourValue, '°', '#')
    ...
0

精彩评论

暂无评论...
验证码 换一张
取 消