Page 1 of 1

PHP Select Statement and Special Signs

Posted: Mon Jun 03, 2002 3:47 am
by Bogdan Zagan
How can I make a select if the database field is something like 'AAA\BBB.CCC'

Posted: Mon Jun 03, 2002 4:55 am
by Bogdan Zagan
I used the

Code: Select all

<?php echo $HTTP_GET_VARS&#1111;"textfield"]; ?>
to see what is actually passed into the SELECT statement.

When I enter in the text field the value
AAA\BBB.CCC
, the output is
AAA\\BBB.CCC
, so the PHP modifies my textfield entered value because of the containing \ sign.
Can I escape from this ?
Because in the database the field contains values like AAA\BBB.CCC, so I need to make a SELECT.

Posted: Mon Jun 03, 2002 5:09 am
by Bogdan Zagan
The web server is Apache on Linux
The DataBase server is MsSql on Windows
The conection is made using FreeTds

Posted: Mon Jun 03, 2002 1:41 pm
by mikeq
Try enclosing it in quotes.

But you should really avoid having any characters like that in a database field name or table name.

Posted: Thu Jun 06, 2002 4:36 am
by Wayne
try using

Code: Select all

stripslashes($HTTP_GET_VARS&#1111;"textfield"]);

Posted: Thu Jun 06, 2002 4:51 am
by twigletmac
so the PHP modifies my textfield entered value because of the containing \ sign
This is caused by having magic_quotes_gpc on in your php.ini file.
php.net wrote:Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically.
Mac