J
Joseph Stateson
I just started calling a php module from html. I added "php rocket" from
microsoft to FP2003 but dont think that is the cause.
The problem is that I am getting a backslash before a double or single quote
and I cannot figure out how to get ride of it.
$query = 'SELECT * FROM cpuinfo where Description like "%xcell%" or
Description like "%q6600%" ';
The above works perfectly but if I attempt to pass the sql string into the
page as follows:
sqlCMD = 'SELECT * FROM cpuinfo where Description like "%xcell%" or
Description like "%q6600%" ';
window.open("cpustats.php?sqlCMD=" + sqlCMD,"_blank");
I see the following on the IE7 explorer address bar:
myserver/mysite/cpustats.php?sqlCMD=SELECT * FROM cpuinfo where Description
like "%xcell%" or Description like "%q6600%"
AGAIN, ONE WOULD THINK THERE IS NOTHING WRONG WITH THE ABOVE.
Low and behold, the following code
$query = $_REQUEST['sqlCMD'] ;
print ($query);
gets expanded to:
SELECT * FROM cpuinfo where Description like \"%xcell%\" or Description like
\"%q6600%\"
I do not know why I see the backslash before the quote. Swapping single and
double quotes has no effect. $_REQUEST seems to substitute backslash before
any quote in a string. My guess is that IE7 (also FF) put it in. The MySql
query fails as it does not handle the backslash before the double (or
single) quote. I would hate to have to parse thru the string and remove the
backslash character when it is before a quote.
anyway, I am open to any suggestions. I am tired of googleing this. All I
found on google were attempts to add backslashes, not get rid of them.
...tia..
ps - if I actually add a \" then I get three backslashes.
microsoft to FP2003 but dont think that is the cause.
The problem is that I am getting a backslash before a double or single quote
and I cannot figure out how to get ride of it.
$query = 'SELECT * FROM cpuinfo where Description like "%xcell%" or
Description like "%q6600%" ';
The above works perfectly but if I attempt to pass the sql string into the
page as follows:
sqlCMD = 'SELECT * FROM cpuinfo where Description like "%xcell%" or
Description like "%q6600%" ';
window.open("cpustats.php?sqlCMD=" + sqlCMD,"_blank");
I see the following on the IE7 explorer address bar:
myserver/mysite/cpustats.php?sqlCMD=SELECT * FROM cpuinfo where Description
like "%xcell%" or Description like "%q6600%"
AGAIN, ONE WOULD THINK THERE IS NOTHING WRONG WITH THE ABOVE.
Low and behold, the following code
$query = $_REQUEST['sqlCMD'] ;
print ($query);
gets expanded to:
SELECT * FROM cpuinfo where Description like \"%xcell%\" or Description like
\"%q6600%\"
I do not know why I see the backslash before the quote. Swapping single and
double quotes has no effect. $_REQUEST seems to substitute backslash before
any quote in a string. My guess is that IE7 (also FF) put it in. The MySql
query fails as it does not handle the backslash before the double (or
single) quote. I would hate to have to parse thru the string and remove the
backslash character when it is before a quote.
anyway, I am open to any suggestions. I am tired of googleing this. All I
found on google were attempts to add backslashes, not get rid of them.
...tia..
ps - if I actually add a \" then I get three backslashes.