View Full Version : extra backlashes on table output

03-28-2007, 07:51 PM
I have an issue that when I extract data from mysql table it's including backlashes with quotes. Example if I enter
"james" in the table when I extract the data I get "\james"\

Is there a function to correct this issue? This is a remote server and I don't have access to the PHP.ini file

I am using the code below to enter a value into the table


I am using the follow code to retrieve the data

<?php echo $row['value_name']; ?>

Both codes are incomplete but these are the lines that I think are affecting the output. Any thoughts or ideas are welcome

03-28-2007, 07:53 PM
There is indeed a function to help you out, it's called stripslashes() (http://us3.php.net/manual/en/function.stripslashes.php).

03-29-2007, 09:00 PM
Those quotes shouldn't be in the database when using mysql_real_escape_string().

It's likely that $value is a GET/POST/COOKIE value (right?) and that PHP is magically adding quotes around that data. Then when you call real_escape, it'll backslash the backslashes so they'll end up in your database. You might want to look into the function get_magic_quotes_gpc and see how you can deal with it, if that is indeed the culprit.