Ashok Gujjar Ashok Gujjar - 10 months ago 21
SQL Question

how to reverse back of mysql_escape_string function in php?

I am storing

"id": "a34da9b020ec86dc5a7832620082ed5d",
"type": "img",
"name": "1458561170282.jpg",
"mime_type": "image/jpg",
"path": "",
"thumb": "",
"short_link": ""

in a MySQL database using

When I retrieve the data I have the following output:

[\n {\n \"short_link\" : \"http:\\\\/\\\\/\\\\/img1085805\",\n \"id\" : \"ca96c55e1aa76fbca17ee08cad7e5a15\",\n \"thumb\" : \"http:\\\\/\\\\/\\\\/boxdata\\\\/asset22114\\\\/images\\\\/thumb__chat_files_41.jpg?r=160421015318\",\n \"type\" : \"img\",\n \"path\" : \"http:\\\\/\\\\/\\\\/boxdata\\\\/asset22114\\\\/images\\\\/chat_files_41.jpg?r=160421015318\",\n \"name\" : \"chat_files_41.jpg\",\n \"mime_type\" : \"image\\\\/jpg\"\n }\n]

How can I convert my data back in the initial format?


Hope this helps

$str='[\n {\n "short_link" : "http:\/\/\/img1085805",
\n "id" : "ca96c55e1aa76fbca17ee08cad7e5a15",
\n "thumb" : "http:\/\/\/boxdata\/asset22114\/images\/thumb__chat_files_41.jpg?r=160421015318",
\n "type" : "img",\n "path" : "http:\/\/\/boxdata\/asset22114\/images\/chat_files_41.jpg?r=160421015318",
\n "name" : "chat_files_41.jpg",\n "mime_type" : "image\/jpg"\n }\n]';
echo stripslashes(str_replace('\n','',$str));

check screenshot enter image description here