0

In my database, there is a value something like that:

i haven't done it yet.

p.s: in the database the value is exactly the same here, there is no backslash.

When I print it php adds backslash before ' single quote.
get_magic_quotes_gpc is off. I dont understand why it is putting a backslash.

here is my php code to print value :

$_SESSION['foo'] = $_POST['foo'];
echo $_SESSION['foo'];
Taz
  • 3,718
  • 2
  • 37
  • 59
Murat
  • 978
  • 7
  • 17
  • Are you viewing your database with phpmyadmin? Maybe php myadmin is stripping the slashes but it really is there, try echo stripslashes($blah)); – Dale Apr 14 '12 at 15:39
  • yes i view with phpmyadmin, i dont know maybe there is. But before i change my server, it wasnt like that. – Murat Apr 14 '12 at 15:45
  • How are you populating `$value`? – Quentin Apr 14 '12 at 15:55
  • 2
    @Murat But you said the value is in your database and you're getting it from `$_POST`. Is it really in your database or is it just submitted by the user? – Mosty Mostacho Apr 14 '12 at 16:51
  • Or `get_magic_quotes_gpc` are not off, or in DB your value is `i haven\'t done it yet.` – Gabriel Santos Apr 15 '12 at 00:17

1 Answers1

-1

Try this

echo stripslashes($value));
Dale
  • 10,384
  • 21
  • 34
  • 2
    That may fix the symptom, but not the underlying problem :) – Evert Apr 14 '12 at 15:46
  • yes, i know stripslashes but the point is that why it puts backslashes while magic_quotes_gpc is off. – Murat Apr 14 '12 at 15:47
  • Are you using mysql_real_escape_string() or anything like that? Without seeing the code your using to insert the data it's anyones guess. Harsh mark down btw – Dale Apr 14 '12 at 15:49
  • Having characters escaped is not a problem, it's a good thing. – Dale Apr 14 '12 at 15:52
  • i realized that when i post the value to store in database , i set it to the session then i print it from session so the problem is php not mysql. – Murat Apr 14 '12 at 15:57
  • This is actually quite interesting I've never had this happen to me before. – Dale Apr 14 '12 at 16:05