stripslashes() when reading from the DB

From: Date: Mon, 12 Jul 2004 18:45:12 +0000
Subject: stripslashes() when reading from the DB
Groups: php.general 
Request: Send a blank email to php-general+get-190272@lists.php.net to get a copy of this message
Hi, I usually stripslashes() when I read the info from the database (MySQL). Because the information was inserted after adding slashes, or the system has magic_quotes_gpc set to ON. I'd like to know, if I can do stripslashes() directly, as it is suposed that all data was inserted into DB after slashing the vars. I mean, should I check or not before if magic_quotes_gpc are on ? As I know, magic_quotes_gpc has nothing to do with info readed from the DB, as it only affects Get/Post/Cookie values. I think to make a check like this: $result = mysql_query("SELECT ...."); $row = mysql_fetch_assoc($result); foreach ($row as $key => $value) {
    $row[$key] = stripslashes($value);
} But not sure if it really necessary, as i'm getting some confusing results. Any help will be welcome Regards, Jordi.

« previous php.general (#190272) next »