Click to See Complete Forum and Search --> : message in php doesnt show new lines
Pouncer
Jun 14th, 2006, 06:31 AM
$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?
Seraphino
Jun 14th, 2006, 06:43 AM
Ok, instead of mysql_fetch_array, try using mysql_fetch_row.
$query = "SELECT `Announcement` FROM `announcement`";
$result = mysql_query($query) or die("Query error<br/>" . mysql_error());
$row = mysql_fetch_row($result);
echo $row[0];
visualAd
Jun 14th, 2006, 06:51 AM
You either need to form at the field as HTML or use the nl2br() (http://www.php.net/nl2br) function to convert new lines to <br>'s.
echo(nl2br($row[0]));
A Popsicle
Jun 15th, 2006, 12:01 AM
Lol, Why Did That Seraphino Guy Get Banned?
Btw, did it work for you?
visualAd
Jun 15th, 2006, 02:08 AM
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 webmaster@vbforums.com instead of creating a new account. More often than not the situation can be resolved by means of an apology. :)
Pouncer
Jun 15th, 2006, 04:15 AM
yes thanks guys sorted
penagate
Jun 15th, 2006, 04:52 AM
Please Mark your Thread Resolved from the Thread Tools menu so no-one else tells you to do it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.