How do I eliminate the \\ from MySQL returned data

Hi,

I tried this and it does not work!
That is before displaying the $body of article I am calling your function provided below, but this is generating an error message that is this error:

Fatal error: Call to undefined function stripslashes_deep() in /var/www/html/anoox.com/news/show_reps.php on line 3615

Boy I hate this magic-quotes crap :frowning:

It is not actually crap. It’s a very little problem, to anyone who studied PHP a bit.
Right now it is just far beyond your knowledge. No problem, in time it will be very easy problem to solve for you.

You have to clear your data once, not calling this function all the time.

So how do you go from creating a browser warning that MySQL could not add your data, due to you having added a ’ to an item from the drop down list to being able to issue a command to the MySQL such as “Drop database”???

You have a link posted above with examples.
If these examples are too hard for you, just trust all the people here. It IS possible.

Hi,

I solved the problem, the issue, without use of this magic-quotes rubbish.
FYI, the problem was with the way the data was inserted which actually was due to an old code which was using a form of magic-quotes.

I guess my knowledge of Php is pretty good :slight_smile:

have a good day,

Magic Quotes is deprecated and will not be in PHP6 because of all the trouble it causes like this.

You can do away with the need for mysql_real_escape_string() as well if you use PREPARE statements in your SQL.

What is PREPARE statement!

A prepare statement is where you prepare the SQL statement beforehand, and then later on (can be immediately too) pass it the required values.


$stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (?, ?)");
$stmt->bindParam(1, $name);
$stmt->bindParam(2, $value);

See: Prepared statements and stored procedures

If you were to use MDB2 (a PEAR library) that might look like:


$mdb2->execParam(
    "INSERT INTO REGISTRY (name, value) VALUES (?, ?)",
    array($name, $value),
    array('text', 'integer')
);

Hi,

What is this: $dbh->
I mean is > the same as an =?
Is it like part of Php6?
ThanX,

From the Prepared statements and stored procedures page, take a look at the left-hand side of the screen, and you will find a table of contents.

Visit the one called Connections and Connection management and you will find out how to use PDO to create a connection to your database.

$dbh is your database handler. It’s a class.

No, -> is where you request a method from a class.

It’s been a part of PHP for some time now. Have a look at The basics of Classes