php - MySQL Escape Backslash -
I have a regular expression that contains escape characters that I need to store in a mysql table.
If I can not escape the backslash, then it has been eliminated.
I have tried to avoid mysql_real_escape_string, addslashes, str_replace, and backslashes using the database from backslash, and each time stores a double backslash instead of a single database < P> example:
$ regex = "stackoverflow \ .com \ question / \ / ask"; $ Query_text = Add Lars ($ regex); Include $ Query = "my_table (url) values ('$ query_text')";
me @ server: $ echo "select * my_table '| mysql -user -database-p'password' stackoverflow \\ com \\ / questions \\ Any questions as to what I am doing wrong?
The slash mysql client's console output has escaped; not in the database;)
Try running the client interactively:
mysql -user - Database -p'password 'mysql & gt; * Choose from my_table; + ---------------------------------- - + | X | + ------------------------------------ + | Stackoverflow \ .com \ / Questions \ / ask | + ----------------------------- ------- + and non-interactive:
mysql -uuser -database -p'password '& lt; ; & Lt; "Avoid * my_table" Use: mysql -uuser -database -p'password '--ORA & lt; & Lt; & Lt; From "My_table * Select * stackoverflow \ .com \ / questions \ / ask manually:
- raw, -r < For tablets output, "Boxing" almost column enables to separate a column value from the other. For non-tabular output (such as in batches mode or when -batch or sycillent option is given), special character output Are saved in order to be easily identified. Newlines, tabs, NULs, and backslashes are written in \ n, \ t, \ 0, and \ The - raw option disables the escape of this character. BTW mysql_real_escape_string was the right escape function to use. < / Html>
Comments
Post a Comment