Re: Insert string with " ' "

From: Date: Tue, 25 Jul 2000 16:02:56 +0000
Subject: Re: Insert string with " ' "
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1467@lists.php.net to get a copy of this message
> 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. On oracle it's solved by specifying it twice, maybe that'll help you. for example: $text = "I saw Tom''s shoes"; and on user input you should do something like this : $text = str_replace("'","''",$user_input); ----- Meir Kriheli MKsoft computer systems 'There's someone in my head but it's not me" - Pink Floyd

« previous php.db (#1467) next »