Forum Moderators: coopster
I have one PHP page which displays a form, and requests input from the user. It then passes a string to another page, which is then passed to MySQL as the search arguement, and the results displayed.
The string from the first program is what I expected to see:
http://example.com/DisplayResults2.php3?arg=%20B_C1%20LIKE%20%22Sid%22
The variable I am passing (arg) is:
B_C1 LIKE "Sid"
so what is being passed looks correct to me.
In the second program, I use 'arg' as the arguement to SQL like this:
$query = "SELECT * FROM Baptisms WHERE $arg";
The trouble is that PHP seems to add an extra '\', so it actuall passes this:
SELECT * FROM Baptisms WHERE B_C1 LIKE \"Sid\"
I cannot for the life of me figure out why it adds extra '\', or how to get rid of them. If anyone can help, I will be eternally greatful.
Thanks.....Nick
[edited by: ergophobe at 10:06 pm (utc) on June 26, 2005]
[edit reason] URL exemplified as per Usage Agreement and forum charter [/edit]
You can read up on it at [us3.php.net...]
Most likely either you have an "addslashes" function somewhere in your code, or magic_quotes_gpc is set to on in php.ini so the double quotes are being automatically escaped by slashes.
APPRECIATE your help!
With regards......Nick