This is a very dull answer, but MySQL has string functions built in, and
one that may help you along the lines of:

INSERT INTO table_name (id, path) VALUES (1, REPLACE("string with
offending \ chars","\","|||");

SELECT REPLACE(path,"|||","\") FROM table_name 

Pedro

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Krings
Sent: Thursday, July 26, 2007 3:34 PM
To: MySQL SIG
Subject: [mysql] Filepath in table

Hi!

For simplicty reasons I want to store an entire file path in a field. 
Since this is on windows, the \ in the path name causes problems. There 
might be also other SQL unfriendly characters in there.
I once came across this and escape the string, but then when using 
stripslashes all slashes were gone, including the one that I needed. 
Back then I decided to circumvent the issue by constantly rebuilding the

file path from scratch.
This time I don't want to do that (too much work) and wonder how else I 
can escape/unescape a file path. I tried a
str_replace("\\", "/", $filepath)
but that appears to be too easy and also does not work as it returns an 
empty string.

Anyone has some expert advice? It is greatly appreciated.


David
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php



_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to