RE: [PHP] How do I get PHP to save a backslash in a Mysql table?

From: Date: Wed, 10 Oct 2007 21:47:30 +0000
Subject: RE: [PHP] How do I get PHP to save a backslash in a Mysql table?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-263069@lists.php.net to get a copy of this message
use mysql_real_escape_string bastien> From: don@program-it.ca> To: php-general@lists.php.net> Date: Wed, 10 Oct 2007 bastien> 13:48:03 -0400> Subject: [PHP] How do I get PHP to save a backslash in a Mysql table?> > bastien> Hi,> > I have a field in which a user inputs a Windows style directory path, hence > using bastien> backslashes and not forward slashes.> > Example: c:\qb\data\mydatadile.qbw> > However, bastien> when the use clicks update, what gets saved is: > c:qbdatamydatadile.qbw> > Does anyone bastien> know if there is a work around?> > The backslashes mysteriously are stripped. I use the bastien> following function to > wrap each variable that's saved in the MySQL table:> > bastien> function update_database($value)> {> // Addslashes> if (!(get_magic_quotes_gpc())) {> bastien> $value = addslashes($value);> }> // Quote if not a number or a numeric string> if bastien> (!is_numeric($value)) {> $value = mysql_real_escape_string($value);> }> return $value;> bastien> }> _________________________________________________________________ R U Ready for Windows Live Messenger Beta 8.5? Try it today! http://entertainment.sympatico.msn.ca/WindowsLiveMessenger

« previous php.general (#263069) next »