Hi Damien, I know that and it is not the problem here. It's newlines that aren't stored correctly not single quotes.
Thanks anyway :) Uli > -----Original Message----- > From: GUITARD Damien [mailto:[EMAIL PROTECTED] > Sent: Friday, February 20, 2004 9:31 AM > To: Ulrich St�rk > Cc: [EMAIL PROTECTED] > Subject: Re: Newlines > > > Hi, > > You must use PHP "addslashes" PHP function before insertion > if the text > contain single quote ( convert ' to \' ), > use "stripslashes" PHP function after retrieve data statement > ( convert > \' to ' ), > and use "nl2br" PHP function after retrieve data statement ( > convert new > line to html <br> ) > > Damien. > > > Ulrich St�rk a �crit: > > >Hi List, > > > >We have got a little problem with insert statements > including newlines. > >We run a PHP application which inserts freetext from a HTML > textarea field into an ASCII varchar field in our database. > >The PHP application puts the content of that textarea field > in a query string and executes the query. The query looks like this: > > > >INSERT INTO table VALUES('Text > >a newline > > > >an empty line above this line') > > > >Checking that string returns that php stores it like this: > > > >INSERT INTO table VALUES('Text\r\na newline\r\n\r\nan empty > line above this line') > > > >Up to this point everything looks as it should. We then use > the linux SAP DB ODBC driver and iODBC to insert it into our database > >and at this point something mysterious happens: each \r and > \n is replaced with a blank so that querying the database > returns 'Text > >a newline an empty line above this line'. > >We thought that it might have something to do with the ODBC > driver and/or iODBC and entered the same insert statement > including the > >newlines into the websql interface - with the same result. > >We then tried different database servers: SAP DB 7.4 running > on a Linux box, SAP DB 7.4 on a Solaris machine and MAX DB 7.5 on a > >Windows host. Same result at least when using the websql > interface. Last thing we did was using the SAP DB 7.5 Windows > ODBC driver > >and PHP on a Windows machine to insert that string into the > database on the Windows host and it worked - the newlines where not > >replaced. We tried the SAP DB 7.4 driver to insert the same > string into the SAP DB 7.4 database running on the Linux box and it > >worked too. > > > >We are a little stuck now and need your assistance. Any > pointers on what we could try? > > > >Thanks in advance > > > >Uli St�rk > > > > > > > > > > > -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
