Hi,
I have a php script that queries a database, When I deploy it locally in my server and I query with the following query:
Select * from patents where casename like '%microsoft%';
It works fine.
However when I deploy it to a remote hosted site, and I run the same query, It doesnt work, because it passes the following query:
Select * from patents where casename like \'%microsoft%\';
How do I remove those slasshes?? I even tried trimming the slashes in the string passed to the mysql server but it wont work.
php script appends extra characters to query when deployed
Moderator: General Moderators
And what doesprint?
Code: Select all
$params = array('magic_quotes_gpc','magic_quotes_runtime','magic_quotes_sybase');
foreach($params as $p) {
echo $p, ': ', ini_get($p) ? 'on':'off', "<br />\n";
}- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Sounds like you have addslashes() being applied somewhere.
This is the Code where the error is occuring:Everah wrote:Sounds like you have addslashes() being applied somewhere.
$query = $_POST["query"];
$query=trim($query,'\\');
print $query;
The query is passed to the script via a html form.
@voika
It displays this:
magic_quotes_gpc: on
magic_quotes_runtime: off
magic_quotes_sybase: off
Take a look at http://de2.php.net/manual/en/ref.info.p ... quotes-gpc and http://de2.php.net/stripslashesmagic_quotes_gpc: on
Can you change settings in the php.ini? Imho magic_quotes_gpc is one of the more #$*?!(censored) features of php.