"Gerrit" <ge****@NOSPAMportaltaurino.com> wrote in message
news:3f***********************@news.xs4all.nl...
HI all
I have a database where one field contains paths to files
ex (images\here_1todo.jpg)
no i'm writing in php a query to select some filenames but i cant work out
al the escapes...
for example
SELECT * FROM Matador_base WHERE Archivo LIKE
'%".AddSlashes(str_replace('_','\_',$arch))."%'",$ db);
does work with $arch = images\here_1
but not with $arch = images\here_1tod
why, what am i missing, how to resolve
thnx
Gerrit
Have you tried htmlentities() before writing your data to the db or
urlencode() or something?
If magic quotes is turned on (it is I believe by default in your php
installation) then you shouldn't have to do much else (perhaps someone else
will correct me here). If you do want to mangle the file name, try using
htmlentities() or urlencode() as opposed to addslashes - Otherwise if you're
not careful you'll end up with PHP (with magic quotes on) adding a slash,
then your addslashes() function adding another slash and just confuse the
hell out of you... You can find out if magic quotes is on by viewing the
output of phpinfo and search for the word magic.
When you say $arch=images\here_1 works, and $arch=images\here_1tod fails, do
you get an error (do you have error reporting on)? Is your column wide
enough in the table? It will chop it if you try to give it too much.
Also, have you tried your query from a mysql client command line before
going to the browser as some characters might get converted in to illegal
html format meaning unless you do a View Source to your web page, you won't
see the results.
Hope that gives you somethin' to work on... and I hope (as a reasonable
newbie to MySQL that I've not steered you up the wrong path).
randell d.