Re: Re: echo?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 http://php.net/manual/en/language.types.string.php

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

On Wednesday, 23 March 2011 at 12:39, Jim Giner wrote: 
> Very Interesting - '\n' doesn't work, but "\n" does work.
> "Steve Staples" <sstaples@xxxxxxxx> wrote in message 
> news:1300883645.5100.973.camel@xxxxxxxxxxx
> > On Wed, 2011-03-23 at 08:28 -0400, Jim Giner wrote:
> > > I am outputting to a <textarea> on an html page. A <br> doesn't work, 
> > > nor
> > > does \n, hence the &#13&#10. Of course, if I don't need the & then I've
> > > just saved two keystrokes. :) Also - I do believe I tried ($i+1) and 
> > > that
> > > didn't work either.
> > > 
> > > "Paul M Foster" <paulf@xxxxxxxxxxxxxxxxx> wrote in message
> > > news:20110323034621.GO1538@xxxxxxxxxxxxxxxxxxxx
> > > > On Tue, Mar 22, 2011 at 10:50:54PM -0400, Jim Giner wrote:
> > > > 
> > > > > Yes - it is J and I. I tried using $i+1 in the echo originally but it
> > > > > wouldn't run. That's why I created $j.
> > > > 
> > > > Yes, the substitution creates a syntax error unless surrounded by
> > > > parentheses or the like.
> > > > 
> > > > > And just what is wrong with the old cr/lf sequence? How would you 
> > > > > have
> > > > > done
> > > > > it?
> > > > 
> > > > You're using HTML-encoded entities for 0x0d and 0x0a. You can simply
> > > > use 0x0d and 0x0a instead. If you're running this in a web context, you
> > > > should use "<br/>" instead of CRLF. At the command line, I'm not
> > > > familiar with running PHP on Windows. In *nix environments, it's enough
> > > > to use "\n", just as they do in C. It might even work in Windows; I
> > > > don't know. If not, you should be able to use "\r\n". You can also try
> > > > the constant PHP_EOL, which is supposed to handle newlines in a
> > > > cross-platform way.
> > > > 
> > > > Paul
> > > > 
> > > > -- 
> > > > Paul M. Foster
> > > > http://noferblatz.com
> > > > http://quillandmouse.com
> > 
> > Jim
> > 
> > with the \n, it does work in a textarea. you must put the \n inside
> > the "", so:
> > 
> > $q = 'select * from director_records ';
> > $qrslt = mysql_query($q);
> > $rows = mysql_num_rows($qrslt);
> > for ($i = 0; $i < $rows; $i++)
> > {
> >  $row = mysql_fetch_array($qrslt);
> >  echo ($i + 1) .'-'. $row['userid'];
> >  if ($row['user_priv'] != "")
> >  echo ' ('. $row['user_priv'] .')';
> >  echo "\n";
> > }
> > 
> > 
> > give that a try
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux