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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux