I currently have a table with \paths\, but they need to be /paths/. Does anyone know what query I need to run in myPHPadmin to get it fixed?
Asked
Active
Viewed 3,240 times
1 Answers
2
SQL has replace function. Here is the link to mySQL docs.
update tablename set columnToUpdate = replace(columnToUpdate, '\\', '/');

Sailesh Babu Doppalapudi
- 1,534
- 1
- 10
- 22
-
That gives me an error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''bhl_product_image' set 'image' = replace('image', '\', '/')' at line 1 – Sokonomi Mar 26 '18 at 20:39
-
Try this query update tablename set columnToUpdate = replace(columnToUpdate, '\\', '/'); – Sailesh Babu Doppalapudi Mar 26 '18 at 20:40
-
@Sokonomi Looks like you didn't double the backslash. And if you're running the query from PHP, you'll need to quadruple it. – Barmar Mar 26 '18 at 21:00
-
@Sokonomi Don't put `bhl_product_image` or `image` in quotes. See https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks – Barmar Mar 26 '18 at 21:01