Problems with \ no update mysql

1

I have a field in a table that holds the path to a locally stored file. When I run the following command:

UPDATE tabela1 set caminho = 'c:\logs\caminho.txt' where cod_tab = 1

it writes without the backslash. Therefore, it saves as follows:

c: logspath.txt

Does anyone have a suggestion of what might be happening? The path is enclosed in single quotation marks (string).

Note: MYSQL (PHPMYADMIN)

    
asked by anonymous 12.06.2016 / 07:03

1 answer

2

This is because you have to escape \ , when you want to insert 'backslashes'. Make:

UPDATE tabela1 set caminho = 'c:\logs\caminho.txt' where cod_tab = 1
    
12.06.2016 / 12:13