PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
rugbyfreak
Forum Newbie
Posts: 10 Joined: Sat May 16, 2009 12:41 pm
Post
by rugbyfreak » Tue May 26, 2009 2:25 pm
Code: Select all
$result = mysql_query("SELECT * FROM commentaire");
while ($row = mysql_fetch_array($result))
{
echo $row["datetime"];
echo "<br/>";
echo $row ["commentaire"];
echo "<br /><hr/>";
}
where do i have to put this "
n2lbr " to have breaks where my user pressed an enter?
Last edited by
Benjamin on Tue May 26, 2009 4:25 pm, edited 1 time in total.
Reason: Changed code type from text to php.
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Tue May 26, 2009 2:55 pm
Use it on the data that needs it.
Do you not understand PHP?
rugbyfreak
Forum Newbie
Posts: 10 Joined: Sat May 16, 2009 12:41 pm
Post
by rugbyfreak » Tue May 26, 2009 3:01 pm
i tried before the $row but it didnn't worked and then before ["commentaire"] and didn't worked too.
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Tue May 26, 2009 4:45 pm
rugbyfreak wrote: i tried before the $row but it didnn't worked and then before ["commentaire"] and didn't worked too.
What was the code you tried?
Zoxive
Forum Regular
Posts: 974 Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan
Post
by Zoxive » Tue May 26, 2009 5:01 pm
As long as the user had line breaks. (\n) It should work around the $row['blahblah']
Code: Select all
<?php
/* .......... */
echo nl2br($row["datetime"]);
echo "<br/>";
echo nl2br($row ["commentaire"]);
echo "<br /><hr/>";
/* .......... */