Created
November 7, 2015 00:05
-
-
Save ViktorNova/9ad2b52daa6b6ec020cb to your computer and use it in GitHub Desktop.
MySQL - Remove hyphens from phone numbers (Asteridex, find & replace)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In this example, user1 is the table name, out is the field name. | |
I'm removing hyphens from phone numbers. | |
Note the mysql names have `backticks` around them while the text fields have 'single quotes' around them. | |
MySQL: | |
```` | |
update `user1` | |
set `out` = replace(`out`, '-', ''); | |
```` | |
PHP: | |
```` | |
$sql = "update `user1`\n" | |
. "set `out` = replace(`out`, \'-\', \'\')"; | |
```` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment