message in php doesnt show new lines
PHP Code:
$query = "SELECT `Announcement` FROM `announcement`";
$result = mysql_query($query) or die("Query error<br/>" . mysql_error());
$row = mysql_fetch_array($result);
echo $row[0];
in the mysql database the message is in paragraphs, but on the php page the message just displays in 1 big lump. how can i fix it?
Re: message in php doesnt show new lines
Ok, instead of mysql_fetch_array, try using mysql_fetch_row.
PHP Code:
$query = "SELECT `Announcement` FROM `announcement`";
$result = mysql_query($query) or die("Query error<br/>" . mysql_error());
$row = mysql_fetch_row($result);
echo $row[0];
Re: message in php doesnt show new lines
You either need to form at the field as HTML or use the nl2br() function to convert new lines to <br>'s.
PHP Code:
echo(nl2br($row[0]));
Re: message in php doesnt show new lines
Lol, Why Did That Seraphino Guy Get Banned?
Btw, did it work for you?
Re: message in php doesnt show new lines
Quote:
Originally Posted by A Popsicle
Lol, Why Did That Seraphino Guy Get Banned?
Btw, did it work for you?
I have no idea. But it would be a wise idea to send an email to the Admins at [email protected] instead of creating a new account. More often than not the situation can be resolved by means of an apology. :)
Re: message in php doesnt show new lines
Re: message in php doesnt show new lines
Please Mark your Thread Resolved from the Thread Tools menu so no-one else tells you to do it.