|
-
Jun 14th, 2006, 06:31 AM
#1
Thread Starter
Frenzied Member
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?
-
Jun 14th, 2006, 06:43 AM
#2
Addicted Member
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];
-
Jun 14th, 2006, 06:51 AM
#3
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]));
-
Jun 15th, 2006, 12:01 AM
#4
New Member
Re: message in php doesnt show new lines
Lol, Why Did That Seraphino Guy Get Banned?
Btw, did it work for you?
-
Jun 15th, 2006, 02:08 AM
#5
Re: message in php doesnt show new lines
 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.
-
Jun 15th, 2006, 04:15 AM
#6
Thread Starter
Frenzied Member
Re: message in php doesnt show new lines
-
Jun 15th, 2006, 04:52 AM
#7
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|