0

I have a database with a field containing a string and a forward slash in it (ie. "some string / with a slash in it"). At the moment of executing a query and extracting the row, the forward slash seems to be gone. Why is this? and How can I get that slash in the query?

I looked around and all I could find was this mysql_real_escape_string() function. But I believe this is for inserting not extracting.

PD: I have the feeling that no forward slash is allowed in databases for some reason. Why?

Thank you

2
  • 8
    Must be something in php or your code. The database itself definitely allows a / in the data. Commented Jan 25, 2012 at 8:13
  • 2
    It seems more likely that you failed to insert the string with a slash than that you cannot extract it with one. Commented Jan 25, 2012 at 8:34

1 Answer 1

1

you might have a stripslashes() call on the string before inserting or after retriving the record

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you guys. I figured it out. I had the code 'if( isset( $data['description'] ) ) $this->description = preg_replace ("/[^\.\,\-\_\'\"\@\?\!\:\$ a-zA-Z0-9()]/","", $data['description'] );' when writing the constructor for the class which was escaping the forward slashes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.