Re: "\n" in PHP

From: Lc (hoho_at_not.me)
Date: 07/11/04


Date: Sun, 11 Jul 2004 20:39:11 +0200

Quite easy to understand:

look at the code generated by your web server after php code has been
interpreted (view source in your IExplorer menu).

When you use /n, the code continues on a new line.
If you don't use /n, the code continues on the same line.

In your example /n is used to facilitate the reading of the HTML code
generated by the web server.

If you use SQL database, /n will be usefull to introduce "new lines" in a
single text stored in only one field of your database...

"Mudge" <mark1822@hotmail.com> a écrit dans le message de
news:%3fIc.69637$Oq2.39135@attbi_s52...
> I am reading a book called "PHP, Apache, MySQL Web Development"
> http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764557440.html
>
> and in its example code it sometimes will have a "\n" in it. It is driving
> me crazy because php will ignore the "\n"s so i have no idea why this book
> has them in there. Does anybody know?
>
> For example:
>
>
> if (mysql_num_rows($result))
> {
> echo "<div class=\"scroller\">\n";
> while ($row = mysql_fetch_array($result))
> {
> echo "<span class='commentname'>".
> htmlspecialchars($row['name']).
> "</span><span class='commentdate'>
> (". date("1 F j, Y H:i", strtotime($row['comment_date'])).
> ")</span>\n";
>
> echo "<p class='commenttext'>\n".
> nl2br(htmlspecialchars($row['comment'])).
> "\n</p>\n";
> }
> echo "</div>\n";
> }
> echo "<br />\n";
>
>
>
> Why does the book put the "\n"s in there?
>



Relevant Pages

  • Re: " " in PHP
    ... look at the code generated by your web server after php code has been ... interpreted (view source in your IExplorer menu). ... If you use SQL database, /n will be usefull to introduce "new lines" in a ...
    (comp.lang.php)
  • Re: suggestions for lisp workshop
    ... a web server with allegroserve and maybe accessing a sql database or ... I also think it's great that you start out with slime showing them how ... A few things I did while learning: ...
    (comp.lang.lisp)
  • C# Builder
    ... I started training in C# Builder and web services and i have a lot of ... problems with using SQL database. ... How can I manipulate with data from web server and call stored procedures. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: " " in PHP
    ... > look at the code generated by your web server after php code has been ... > interpreted (view source in your IExplorer menu). ... > generated by the web server. ... > single text stored in only one field of your database... ...
    (comp.lang.php)
  • Denyace<3
    ... I am running a web server and have a sql database linkage.I have run ... IISlockdown but have found that my c:\inetpub\site has been given ... Chris ...
    (microsoft.public.inetserver.iis.security)