open All Channels
seplocked EVE Technology Lab
blankseplocked Copying Chat Logs into a Database Without Losing line Breaks
 
This thread is older than 90 days and has been locked due to inactivity.


 
Author Topic

D13s 1r43
Posted - 2011.07.26 06:37:00 - [1]
 

I've got a site that takes in chat logs copied from in-game in a textarea box, stores them in a MYSQL database, then outputs them as text on a PHP page. I'm finding that the chat logs don't retain their line breaks, taking

LINE1
LINE2
LINE3

to

LINE1 LINE2 LINE3

Is there a way to preserve the line breaks somehow in PHP and the database?

Cruthensis
Gallente
Xeno Tech Corp
Self Destruct.
Posted - 2011.07.26 08:20:00 - [2]
 

Have a look at what's actually being stored in the DB with something like phpmyadmin. I suspect the linebreaks are being stored. More likely: you're outputting the content without converting the plain linebreaks into something that a browser will actually treat as a linebreak ie: <br />

Try the nl2br(string) function.

D13s 1r43
Posted - 2011.07.26 15:59:00 - [3]
 

That worked, thanks

Dragonaire
Caldari
Corax.
PURgE Alliance
Posted - 2011.07.27 05:07:00 - [4]
 

another option is putting them inside <pre> tags.


 

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only