Re: "\n" in PHP

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


Date: Sun, 11 Jul 2004 20:45:01 +0200


"Lc" <hoho@not.me> a écrit dans le message de news:...
> 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: getimagesize() not working
    ... The url in question is pulling longblob data from the database. ... you have a PHP script that fetches data from DB ... PHP code and it won't find its dimensions since it's not an ... You should make file_get_contentsload the file through the web server so ...
    (comp.lang.php)
  • Re: Is this a reasonable thing to do?
    ... sensible to write a little PHP code to loop through each specifier and ... line tool is for my database. ... There's no need to go through a web server ...
    (comp.lang.php)
  • witm - Web Interface To Mathematica.
    ... I've made some quite significant changes to the php code I mentioned a few days back. ... It can now run most Mathematica commands, as well as display 2D and 3D graphics. ... Web server configured for PHP. ... Dave K MCSE. ...
    (sci.math.symbolic)
  • Re: The 2nd last ever php thread
    ... used to understand HTML ... - the web server recognises the .php file extension ... if found - the web server will examine and process the php code ... 'If the user is John then display Hi John, if the user is Fred then display Go away Fred' ...
    (uk.media.tv.misc)
  • Re: .INC file not being included
    ... but what happens when someone tries to directly access the ... the php code itself and access the database credentials, of course depending ... on how the web server has been configured. ...
    (alt.php)