mysql
Joed asked:


I have this problem in storing URL in mySql. I tried to put the URL which came from the file chooser into a String variable. When I printed it, it seemed to be ok but when I saved it in the database, all the backslashes were gone. What should I do? Please help me. Thanks in advance.

Comments

Mehdi on 17 August, 2008 at 4:57 am #

Escape them by *adding* a backslash:

  C:\\Documents and Settings\\blah\\blah blah


acb29 on 20 August, 2008 at 5:10 am #

Use mysql_real_escape_string() function clean strings of SQL syntax before inserting them into my database.


Greg P on 20 August, 2008 at 7:07 am #

check your table, if you are storing URLs, you will probably want to use something like varchar (50)

You may be using a table that doesn’t accept those characters.


just "JR" on 20 August, 2008 at 1:50 pm #

Use these three Php functions:
addslashes, stripslashes and str_replace
Use stripslashes first ( “\\\” -> “\\” )
To remove escaped backslashes, use str_replace(”\\” ,”", $string);
Check viewing your table contents directly, then their output into a text on screen.


Post a Comment
Name:
Email:
Website:
Comments: