RE: [PHP-DB] Insert string with " ' "
| From: | Sam Masiello | Date: | Tue, 25 Jul 2000 13:05:59 +0000 |
| Subject: | RE: [PHP-DB] Insert string with " ' " | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1466@lists.php.net to get a copy of this message | ||
Before inserting into your database, try doing this:
$text = addslashes($text) ;
This will escape any characters that require it before trying to insert it
into the database.
Sam Masiello
System Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: Mirko Nalesso [mailto:okrim74@libero.it]
Sent: Tuesday, July 25, 2000 9:01 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Insert string with " ' "
Hi people,
I have a problem when I try to insert a string containing the character
" ' ".I'm working with IBM DB2 v6.1 and php4. Example:
....
$text = "I saw Tom's shoes";
$query = "INSERT INTO documents VALUES ('$text');
....
DB2 thinks that "I saw Tom" is the string to insert and "s shoes" is an
error. What can I do?
Mirko.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net