note 39580 added to function.stripslashes

From: Date: Tue, 03 Feb 2004 02:14:12 +0000
Subject: note 39580 added to function.stripslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-64579@lists.php.net to get a copy of this message
All the books tell you to use addslashes() when you put data into a database, and then stripslashes() when you get it back. After wasting hours, I found that stripslashes() is only required if php.ini contains magic_quotes_runtime = On. The extra slashes are required for input to the database, but they are never stored in the database. If magic_quotes_runtime is on, the results of queries come back with slashes, so you think the slashes are in the database, but they are not. They are being added by php to the "incoming data", and you then strip them off again. Once magic_quotes_runtime is off, you can forget about stripslashes() unless there is a specific task you need it for. ---- Manual Page -- http://www.php.net/manual/en/function.stripslashes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39580 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39580&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39580&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64579) next »