lme lme -4 years ago 97
MySQL Question

How to storage the "\" in database?

I write a method to store a string in navigate, but the string is like this:


So, it is crash:

[SQL] call P_A_OperReg_Bio("liaomalin", "511321199001031598", "P_1", "http:p_1......", "http://p1_url1..", "md5_p1_md51", "http://p1_url2..", "md5_p1_md52", "http://p1_url3..", "","data\510000RS\Other\", "20170202", "", @a);
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '20170202", "", @a);
SELECT @a' at line 1

The snapshot:

enter image description here

How to solve this issue?

If I have the string :


How can I transform it to :


Answer Source

You need to escape if with another slash before it:


If it's inside a program, DON'T DO THAT, it's unsecure! Use prepared statements.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download