| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Roger Baklund | Date: | September 11 2005 9:49pm |
| Subject: | Re: HTML in MySQL? | ||
| View as plain text | |||
Vladimir B. Tsarkov wrote: > After the execution of the script: > > <?php > $string = "\n\n\n\n 1"; > echo addslashes($string); > ?> > > we will get: > > 1 > > and no empty lines. > > If you want to output the same data, that was written using a textarea field > of a form, you should use the "<br>" tag. In one word: kiss. Converting the data before inserting it in the database, and converting it back after reading from the database, is more work and more error-prone, compared to not doing this conversion. You can easily do the conversion when you output the data, _if_ the output format is html, _and_ you actually want "hard" linefeeds in your html output. Many web pages have a variable width... there is a reason for why whitespace usually is not significant in html. The problem you describe above is not related to mysql, and you could probably solve it another way. You should take a look at the html <pre> element. -- Roger
| Thread | ||
|---|---|---|
| • HTML in MySQL? | clint lenard | 9 Sep |
| • Re: HTML in MySQL? | Jasper Bryant-Greene | 9 Sep |
| • Re: HTML in MySQL? | clint lenard | 9 Sep |
| • Re: HTML in MySQL? | Jasper Bryant-Greene | 9 Sep |
| • Re: HTML in MySQL? | clint lenard | 9 Sep |
| • Re: HTML in MySQL? | douglass_davis | 12 Sep |
| • Re: HTML in MySQL? | clint lenard | 12 Sep |
| • Re: HTML in MySQL? | clint lenard | 12 Sep |
| • Re: HTML in MySQL? | clint lenard | 12 Sep |
| • Re: HTML in MySQL? | Hassan Schroeder | 12 Sep |
| • RE: HTML in MySQL? | SST - Adelaide) | 9 Sep |
| • Re: HTML in MySQL? | Unknown Sender | 9 Sep |
| • Re: HTML in MySQL? | Unknown Sender | 9 Sep |
| • RE: HTML in MySQL? | Alan Williamson | 9 Sep |
| • Re: HTML in MySQL? | Unknown Sender | 9 Sep |
| • Re: HTML in MySQL? | gerald_clark | 9 Sep |
| • Re: HTML in MySQL? | Filipe Tomita | 9 Sep |
| • Re: HTML in MySQL? | Unknown Sender | 9 Sep |
| • RE: HTML in MySQL? | John Trammell | 9 Sep |
| • Re: HTML in MySQL? | Unknown Sender | 11 Sep |
| • Re: HTML in MySQL? | Roger Baklund | 11 Sep |
| • Re: HTML in MySQL? | Unknown Sender | 11 Sep |
| • RE: HTML in MySQL? | John Trammell | 11 Sep |
| • Re: HTML in MySQL? | Jasper Bryant-Greene | 12 Sep |
| • Re: HTML in MySQL? | Jasper Bryant-Greene | 12 Sep |
| • Re: HTML in MySQL? | clint lenard | 12 Sep |
