RE: [PHP-DB] Line breaks from a database!

2002-07-02 Thread Ryan Jameson (USA)

Well, here's what I got, since I put the data into the table directly it had no extra 
slashes so it looked like this '\n' , but when retrieving it i ended up with '\\n'. I 
would have expected stripSlashes to work but that turned them into 'n'. Here's what I 
did as a workaround: 

function strip($string){
  $string = str_replace("\\n","\n", $string);
  return $string;
}

believe it or not, this works when stripSlashes does not. Anyone know why?

<>< Ryan


"Ryan Jameson (USA)" <[EMAIL PROTECTED]> said:

> Hi guys, maybe I'm missing something silly but when I retrieve a string 
from my SQL server with '\n' in it, they are displayed literally instead of 
as line breaks. StripSlashes only turns them into 'n'.
> 
> Any ideas?
> 
> <>< Ryan
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Line breaks from a database!

2002-07-02 Thread Maureen

Try nl2br().

ie. 
$var=nl2br($var);

This replaces \n with 



"Ryan Jameson (USA)" <[EMAIL PROTECTED]> said:

> Hi guys, maybe I'm missing something silly but when I retrieve a string 
from my SQL server with '\n' in it, they are displayed literally instead of 
as line breaks. StripSlashes only turns them into 'n'.
> 
> Any ideas?
> 
> <>< Ryan
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Line breaks from a database!

2002-07-02 Thread Ryan Jameson (USA)

Hi guys, maybe I'm missing something silly but when I retrieve a string from my SQL 
server with '\n' in it, they are displayed literally instead of as line breaks. 
StripSlashes only turns them into 'n'.

Any ideas?

<>< Ryan

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php