Re: [PHP] Re: echo?

2011-03-24 Thread Tamara Temple


On Mar 22, 2011, at 9:50 PM, 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.


Interesting it wouldn't run.. perhaps that's a place to investigate?

And just what is wrong with the old cr/lf sequence?  How would you  
have done

it?


If it is being sent to a browser, which i suspect given the html  
entities encoding, i would have used br /.


If it is being sent to a terminal or file, I would have used \n.


What do you mean 'this alone .'?


Merely that the construction I see shouldn't matter whether you use $j  
or $i+1.



Tamara Temple tamouse.li...@gmail.com wrote in message
news:521bdb9d-adbf-45d7-b759-acd315b19...@gmail.com...


On Mar 22, 2011, at 8:42 PM, Jim Giner wrote:


ok - here's the code in question.
$q = 'select * from director_records ';
$qrslt = mysql_query($q);
$rows = mysql_num_rows($qrslt);
for ($i=0; $i$rows; $i++)
  {
  $j = $i+1;


Am i reading this correctly: the first variable is j (jay) the second
variable is i (eye) ?

This alone doesn't explain anything...


  $row = mysql_fetch_array($qrslt);
  echo $j.'-'.$row['userid'];


Since this is the only place $j is used, try subbing in $i+1 and  
see  what

you get.


  if ($row['user_priv'] )
  echo ' ('.$row['user_priv'].')#13#10';


This is really rather a strange way of getting a line break.


  else
  echo '#13#10';
  }


The output I get is:


1-smith5
f-ginerjm (M)
g-smith8

While the alpha parts are valid, the index is only correct for  
the  first

one
(0) obviously.



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



Re: [PHP] Re: echo?

2011-03-24 Thread Hans Åhlin
2011/3/23 Jim Giner jim.gi...@albanyhandball.com:
 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
    {
    $j = $i+1;
    $row = mysql_fetch_array($qrslt);
    echo $j.'-'.$row['userid'];
    if ($row['user_priv'] )

try         echo ' ('.$row['user_priv'].)#13#10\r\n; //If you
don't put \r\n or a space at the end of the echo then the beginning on
the next line is going to be interpreted as #101/#102/#103 aso (that i
figured when you wrote that putting a space in the beginning of the
echo solved the problem.

    else

        echo #13#10\r\n;

    }



-- 


**
 Hans Åhlin
   Tel: +46761488019
   icq: 275232967
   http://www.kronan-net.com/
   irc://irc.freenode.net:6667 - TheCoin
**

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



[PHP] Re: echo?

2011-03-23 Thread Geoff Lane
Hi Jim,

On Wednesday, March 23, 2011, 1:42:18 AM, you wrote:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
 {
 $j = $i+1;
 $row = mysql_fetch_array($qrslt);
 echo $j.'-'.$row['userid'];
 if ($row['user_priv'] )
 echo ' ('.$row['user_priv'].')#13#10';
 else
 echo '#13#10';
 }


 The output I get is:


 1-smith5
 f-ginerjm (M)
 g-smith8

 While the alpha parts are valid, the index is only correct for the first one 
 (0) obviously.


I couldn't understand why you're getting characters, so I thought I'd
have a go myself. First, some DDL and DML to recreate your data:

  create table director_records (userid char(16), user_priv char(8));
  insert into director_records (userid, user_priv) values ('smith5', 
''),('ginerjm','M'),('smith8','');

Now when I ran your code I got:

1-smith5#13#102-ginerjm (M)#13#103-smith8#13#10

That is, all but the first result has #10x in front of it. These are
HTML entities that display as characters and it so happens that #102
is 'j' and #103 is 'g'. Strictly, these entities should be terminated
with a semi-colon (i.e. #102; and #103;), but your browser is
'obligingly' making sense of the 'bad formatting' and  this is why
you're getting characters.

BTW, an alternative to your for construct would be to use a while loop
to iterate through a data table. e.g. in your case, I'd have used:

  $q = 'select * from director_records ';
  $qrslt = mysql_query($q);
  $i = 1;
  while ($row = mysql_fetch_array($qrslt)){
  echo $i++ . '-' . $row['userid'];
  if ($row['user_priv']){
  echo  ( . $row['user_priv'] . );
  }
  echo br\n;
  }

HTH,

-- 
Geoff Lane
Cornwall, UK
ge...@gjctech.co.uk


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



Re: [PHP] Re: echo?

2011-03-23 Thread Frank Arensmeier

23 mar 2011 kl. 02.42 skrev Jim Giner:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
{
$j = $i+1;
$row = mysql_fetch_array($qrslt);
echo $j.'-'.$row['userid'];
if ($row['user_priv'] )
echo ' ('.$row['user_priv'].')#13#10';
else
echo '#13#10';
}
 
 
 The output I get is:
 
 
 1-smith5
 f-ginerjm (M)
 g-smith8
 
 While the alpha parts are valid, the index is only correct for the first one 
 (0) obviously.
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Why not try some basic debugging strategies and see what you get?

Try:
for ($i=0; $i$rows; $i++)
   {
   var_dump($i);
   $j = $i+1;
   $row = mysql_fetch_array($qrslt);
   echo $j.'-'.$row['userid'];
   var_dump($j);
   if ($row['user_priv'] )
   echo ' ('.$row['user_priv'].')#13#10';
   else
   echo '#13#10';
   }

The output you've posted, that's rendered output, right? What's the raw output?

By the way, the code snippet you gave us is not complete. Is there anything 
else? As Dan noticed earlier, judging from that code snippet only, there must 
be something else funky going on.

/frank



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



Re: [PHP] Re: echo?

2011-03-23 Thread Ricardo Martinez
Hi

after of the for, u can use



it shoulds back the class of variable, by example its is string its is
int etc

for ($i=0;$i$rows;$i++)
echo $i.' '.$row['itemname'];

echo gettype($i);

Can be that you must define before the class of this variable, because, the
system is thinking this is a string class data or hexa etc.

grettings and sorry for my written english ;)


-- 
Ricardo
___
IT Architect
website: http://www.pulsarinara.com


Re: [PHP] Re: echo?

2011-03-23 Thread Richard Quadling
On 23 March 2011 07:46, Geoff Lane ge...@gjctech.co.uk wrote:
 Hi Jim,

 On Wednesday, March 23, 2011, 1:42:18 AM, you wrote:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
     {
     $j = $i+1;
     $row = mysql_fetch_array($qrslt);
     echo $j.'-'.$row['userid'];
     if ($row['user_priv'] )
         echo ' ('.$row['user_priv'].')#13#10';
     else
         echo '#13#10';
     }


 The output I get is:


 1-smith5
 f-ginerjm (M)
 g-smith8

 While the alpha parts are valid, the index is only correct for the first one
 (0) obviously.


 I couldn't understand why you're getting characters, so I thought I'd
 have a go myself. First, some DDL and DML to recreate your data:

  create table director_records (userid char(16), user_priv char(8));
  insert into director_records (userid, user_priv) values ('smith5', 
 ''),('ginerjm','M'),('smith8','');

 Now when I ran your code I got:

 1-smith5#13#102-ginerjm (M)#13#103-smith8#13#10

 That is, all but the first result has #10x in front of it. These are
 HTML entities that display as characters and it so happens that #102
 is 'j' and #103 is 'g'. Strictly, these entities should be terminated
 with a semi-colon (i.e. #102; and #103;), but your browser is
 'obligingly' making sense of the 'bad formatting' and  this is why
 you're getting characters.

 BTW, an alternative to your for construct would be to use a while loop
 to iterate through a data table. e.g. in your case, I'd have used:

  $q = 'select * from director_records ';
  $qrslt = mysql_query($q);
  $i = 1;
  while ($row = mysql_fetch_array($qrslt)){
      echo $i++ . '-' . $row['userid'];
      if ($row['user_priv']){
          echo  ( . $row['user_priv'] . );
      }
      echo br\n;
  }

 HTH,

I use ...

while(False !== ($row = mysql_fetch_array($qrslt)){
}

just so that if I have a query with 1 cell which is 0, or '', I don't
abort the loop.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Re: echo?

2011-03-23 Thread Jim Giner
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 pa...@quillandmouse.com wrote in message 
news:20110323034621.go1...@quillandmouse.com...
 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 



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



[PHP] Re: echo?

2011-03-23 Thread Jim Giner
By george - I think you've solved it!

As for my coding choice - that's the beauty of programming - everybody has a 
way of solving a problem/creating a solution.  Unless you are concerned with 
performance(which in this particular case is not a concern), there is no 
'wrong way'.
Geoff Lane ge...@gjctech.co.uk wrote in message 
news:1278073104.20110323074...@gjctech.co.uk...
 Hi Jim,

 On Wednesday, March 23, 2011, 1:42:18 AM, you wrote:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
 {
 $j = $i+1;
 $row = mysql_fetch_array($qrslt);
 echo $j.'-'.$row['userid'];
 if ($row['user_priv'] )
 echo ' ('.$row['user_priv'].')#13#10';
 else
 echo '#13#10';
 }


 The output I get is:


 1-smith5
 f-ginerjm (M)
 g-smith8

 While the alpha parts are valid, the index is only correct for the first 
 one
 (0) obviously.


 I couldn't understand why you're getting characters, so I thought I'd
 have a go myself. First, some DDL and DML to recreate your data:

  create table director_records (userid char(16), user_priv char(8));
  insert into director_records (userid, user_priv) values ('smith5', 
 ''),('ginerjm','M'),('smith8','');

 Now when I ran your code I got:

 1-smith5#13#102-ginerjm (M)#13#103-smith8#13#10

 That is, all but the first result has #10x in front of it. These are
 HTML entities that display as characters and it so happens that #102
 is 'j' and #103 is 'g'. Strictly, these entities should be terminated
 with a semi-colon (i.e. #102; and #103;), but your browser is
 'obligingly' making sense of the 'bad formatting' and  this is why
 you're getting characters.

 BTW, an alternative to your for construct would be to use a while loop
 to iterate through a data table. e.g. in your case, I'd have used:

  $q = 'select * from director_records ';
  $qrslt = mysql_query($q);
  $i = 1;
  while ($row = mysql_fetch_array($qrslt)){
  echo $i++ . '-' . $row['userid'];
  if ($row['user_priv']){
  echo  ( . $row['user_priv'] . );
  }
  echo br\n;
  }

 HTH,

 -- 
 Geoff Lane
 Cornwall, UK
 ge...@gjctech.co.uk
 



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



Re: [PHP] Re: echo?

2011-03-23 Thread Steve Staples
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 pa...@quillandmouse.com wrote in message 
 news:20110323034621.go1...@quillandmouse.com...
  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



Re: [PHP] Re: echo?

2011-03-23 Thread Jim Giner
not the concern in this posting
Richard Quadling rquadl...@gmail.com wrote in message 
news:aanlktindqu7bzeamtcwh6y9f3m9yjxqpt-ime9ysh...@mail.gmail.com...
On 23 March 2011 07:46, Geoff Lane ge...@gjctech.co.uk wrote:
 Hi Jim,

 On Wednesday, March 23, 2011, 1:42:18 AM, you wrote:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
 {
 $j = $i+1;
 $row = mysql_fetch_array($qrslt);
 echo $j.'-'.$row['userid'];
 if ($row['user_priv'] )
 echo ' ('.$row['user_priv'].')#13#10';
 else
 echo '#13#10';
 }


 The output I get is:


 1-smith5
 f-ginerjm (M)
 g-smith8

 While the alpha parts are valid, the index is only correct for the first 
 one
 (0) obviously.


 I couldn't understand why you're getting characters, so I thought I'd
 have a go myself. First, some DDL and DML to recreate your data:

 create table director_records (userid char(16), user_priv char(8));
 insert into director_records (userid, user_priv) values ('smith5', 
 ''),('ginerjm','M'),('smith8','');

 Now when I ran your code I got:

 1-smith5#13#102-ginerjm (M)#13#103-smith8#13#10

 That is, all but the first result has #10x in front of it. These are
 HTML entities that display as characters and it so happens that #102
 is 'j' and #103 is 'g'. Strictly, these entities should be terminated
 with a semi-colon (i.e. #102; and #103;), but your browser is
 'obligingly' making sense of the 'bad formatting' and this is why
 you're getting characters.

 BTW, an alternative to your for construct would be to use a while loop
 to iterate through a data table. e.g. in your case, I'd have used:

 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $i = 1;
 while ($row = mysql_fetch_array($qrslt)){
 echo $i++ . '-' . $row['userid'];
 if ($row['user_priv']){
 echo  ( . $row['user_priv'] . );
 }
 echo br\n;
 }

 HTH,

I use ...

while(False !== ($row = mysql_fetch_array($qrslt)){
}

just so that if I have a query with 1 cell which is 0, or '', I don't
abort the loop.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY 



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



Re: [PHP] Re: echo?

2011-03-23 Thread Jim Giner
it was as complete as need be to demonstrate my dilemma, as Richard has 
discovered above
Frank Arensmeier farensme...@gmail.com wrote in message 
news:7cfb015a-c530-4712-9ebc-fbdf5b0ed...@gmail.com...

23 mar 2011 kl. 02.42 skrev Jim Giner:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
{
$j = $i+1;
$row = mysql_fetch_array($qrslt);
echo $j.'-'.$row['userid'];
if ($row['user_priv'] )
echo ' ('.$row['user_priv'].')#13#10';
else
echo '#13#10';
}


 The output I get is:


 1-smith5
 f-ginerjm (M)
 g-smith8

 While the alpha parts are valid, the index is only correct for the first 
 one
 (0) obviously.



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


Why not try some basic debugging strategies and see what you get?

Try:
for ($i=0; $i$rows; $i++)
   {
   var_dump($i);
   $j = $i+1;
   $row = mysql_fetch_array($qrslt);
   echo $j.'-'.$row['userid'];
   var_dump($j);
   if ($row['user_priv'] )
   echo ' ('.$row['user_priv'].')#13#10';
   else
   echo '#13#10';
   }

The output you've posted, that's rendered output, right? What's the raw 
output?

By the way, the code snippet you gave us is not complete. Is there anything 
else? As Dan noticed earlier, judging from that code snippet only, there 
must be something else funky going on.

/frank




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



Re: [PHP] Re: echo?

2011-03-23 Thread Jim Giner
Very Interesting - '\n' doesn't work, but \n does work.
Steve Staples sstap...@mnsi.net wrote in message 
news:1300883645.5100.973.camel@webdev01...
 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 pa...@quillandmouse.com wrote in message
 news:20110323034621.go1...@quillandmouse.com...
  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



Re: [PHP] Re: echo?

2011-03-23 Thread Stuart Dallas
 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 sstap...@mnsi.net wrote in message 
 news:1300883645.5100.973.camel@webdev01...
  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 pa...@quillandmouse.com wrote in message
   news:20110323034621.go1...@quillandmouse.com...
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



[PHP] Re: echo?

2011-03-23 Thread Jim Giner
As Richard proved my problem was caused by my use of the archaic cr/lf 
character pair.  Once I found the correct syntax for using \n my output of 
the loop counter worked.

thanks for all the suggestions.  My first experience on a PHP newsgroup and 
it was a postiive one.  I've spent the last 12+ years using newsgroups for 
Paradox development and this group is *just* as supportive and 
knowledgeable.

(no jokes about using paradox for so long.  If your users can manage on a 
desktop solution, pdox can't be beaten for what it could/can do.) 



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



Re: [PHP] Re: echo?

2011-03-23 Thread Jim Giner
Thanks for the pointer.  Had not run across that tidbit before.
Stuart Dallas stu...@3ft9.com wrote in message 
news:b43dfd4fa2ac4489aaf538d1bf7a8...@3ft9.com...
 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 sstap...@mnsi.net wrote in message
 news:1300883645.5100.973.camel@webdev01...
  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 pa...@quillandmouse.com wrote in message
   news:20110323034621.go1...@quillandmouse.com...
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



Re: [PHP] Re: echo?

2011-03-23 Thread Paul M Foster
On Wed, Mar 23, 2011 at 07:46:03AM +, Geoff Lane wrote:

 Hi Jim,
 
 On Wednesday, March 23, 2011, 1:42:18 AM, you wrote:
 
  ok - here's the code in question.
  $q = 'select * from director_records ';
  $qrslt = mysql_query($q);
  $rows = mysql_num_rows($qrslt);
  for ($i=0; $i$rows; $i++)
  {
  $j = $i+1;
  $row = mysql_fetch_array($qrslt);
  echo $j.'-'.$row['userid'];
  if ($row['user_priv'] )
  echo ' ('.$row['user_priv'].')#13#10';
  else
  echo '#13#10';
  }
 
 
  The output I get is:
 
 
  1-smith5
  f-ginerjm (M)
  g-smith8
 
  While the alpha parts are valid, the index is only correct for the first 
  one 
  (0) obviously.
 
 
 I couldn't understand why you're getting characters, so I thought I'd
 have a go myself. First, some DDL and DML to recreate your data:
 
   create table director_records (userid char(16), user_priv char(8));
   insert into director_records (userid, user_priv) values ('smith5', 
 ''),('ginerjm','M'),('smith8','');
 
 Now when I ran your code I got:
 
 1-smith5#13#102-ginerjm (M)#13#103-smith8#13#10
 
 That is, all but the first result has #10x in front of it. These are
 HTML entities that display as characters and it so happens that #102
 is 'j' and #103 is 'g'. Strictly, these entities should be terminated
 with a semi-colon (i.e. #102; and #103;), but your browser is
 'obligingly' making sense of the 'bad formatting' and  this is why
 you're getting characters.
 
 BTW, an alternative to your for construct would be to use a while loop
 to iterate through a data table. e.g. in your case, I'd have used:
 
   $q = 'select * from director_records ';
   $qrslt = mysql_query($q);
   $i = 1;
   while ($row = mysql_fetch_array($qrslt)){
   echo $i++ . '-' . $row['userid'];
   if ($row['user_priv']){
   echo  ( . $row['user_priv'] . );
   }
   echo br\n;
   }
 
 HTH,

*Brilliant* catch. Well done.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



Re: [PHP] Re: echo?

2011-03-23 Thread David Robley
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 pa...@quillandmouse.com wrote in message
 news:20110323034621.go1...@quillandmouse.com...
 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

It's possibly worth reinforcing at this stage of the game that #13 and #10
are incorrectly formed strings to represent CR and LF, in that they should
have a closing semicolon to delimit the end of the entity. I think this was
pointed out elsewhere but I believe it deserves repeating.


Cheers
-- 
David Robley

Sumo Wrestling: survival of the fattest.
Today is Pungenday, the 10th day of Discord in the YOLD 3177. 


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



[PHP] Re: echo?

2011-03-22 Thread Al



On 3/22/2011 6:22 PM, Jim Giner wrote:

Kinda new to this, but I've been puttering/writing for about 3 weeks now and
have some good working screens up.  Ran into something new while I was
debuggina script today.

Tried to echo the $i value within a for loop as part of the list of items I
was building
Something like

for ($i=0;$i$rows;$i++)
 echo $i.' '.$row['itemname'];

I expected to see :

1 item1
2 item2
...
...

but instead I got

1 item1
f item2

Yes - an 'f' and not a 2.

Tried it some more with this:

for ($i=1;$i10;$i++)
 echo $i. item.'br';

and got

c item
d item
e item
f item
g item

and so on.

It seems that I can only output the value of $i if I output a string in
front of it

echo ' '.$i;

works fine but
echo $i;
does not.

Any ideas?




If off your subject a bit; but, I suggest using
$i=0;
foreach($row as $value)
   {
echo $i $valuebr /\n;
$i++;
  }


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



[PHP] Re: echo?

2011-03-22 Thread Jim Giner
ok - here's the code in question.
$q = 'select * from director_records ';
$qrslt = mysql_query($q);
$rows = mysql_num_rows($qrslt);
for ($i=0; $i$rows; $i++)
{
$j = $i+1;
$row = mysql_fetch_array($qrslt);
echo $j.'-'.$row['userid'];
if ($row['user_priv'] )
echo ' ('.$row['user_priv'].')#13#10';
else
echo '#13#10';
}


The output I get is:


1-smith5
f-ginerjm (M)
g-smith8

While the alpha parts are valid, the index is only correct for the first one 
(0) obviously.



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



Re: [PHP] Re: echo?

2011-03-22 Thread Tamara Temple


On Mar 22, 2011, at 8:42 PM, Jim Giner wrote:


ok - here's the code in question.
$q = 'select * from director_records ';
$qrslt = mysql_query($q);
$rows = mysql_num_rows($qrslt);
for ($i=0; $i$rows; $i++)
   {
   $j = $i+1;


Am i reading this correctly: the first variable is j (jay) the second  
variable is i (eye) ?


This alone doesn't explain anything...


   $row = mysql_fetch_array($qrslt);
   echo $j.'-'.$row['userid'];


Since this is the only place $j is used, try subbing in $i+1 and see  
what you get.



   if ($row['user_priv'] )
   echo ' ('.$row['user_priv'].')#13#10';


This is really rather a strange way of getting a line break.


   else
   echo '#13#10';
   }


The output I get is:


1-smith5
f-ginerjm (M)
g-smith8

While the alpha parts are valid, the index is only correct for the  
first one

(0) obviously.



--
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



Re: [PHP] Re: echo?

2011-03-22 Thread Jim Giner
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.
And just what is wrong with the old cr/lf sequence?  How would you have done 
it?
What do you mean 'this alone .'?
Tamara Temple tamouse.li...@gmail.com wrote in message 
news:521bdb9d-adbf-45d7-b759-acd315b19...@gmail.com...

 On Mar 22, 2011, at 8:42 PM, Jim Giner wrote:

 ok - here's the code in question.
 $q = 'select * from director_records ';
 $qrslt = mysql_query($q);
 $rows = mysql_num_rows($qrslt);
 for ($i=0; $i$rows; $i++)
{
$j = $i+1;

 Am i reading this correctly: the first variable is j (jay) the second 
 variable is i (eye) ?

 This alone doesn't explain anything...

$row = mysql_fetch_array($qrslt);
echo $j.'-'.$row['userid'];

 Since this is the only place $j is used, try subbing in $i+1 and see  what 
 you get.

if ($row['user_priv'] )
echo ' ('.$row['user_priv'].')#13#10';

 This is really rather a strange way of getting a line break.

else
echo '#13#10';
}


 The output I get is:


 1-smith5
 f-ginerjm (M)
 g-smith8

 While the alpha parts are valid, the index is only correct for the  first 
 one
 (0) obviously.



 -- 
 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



Re: [PHP] Re: echo?

2011-03-22 Thread Paul M Foster
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

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



[PHP] Re: Echo result in a loop on each instance

2009-06-23 Thread Peter Ford
Anton Heuschen wrote:
 I have a question regarding echo of a var/string in a loop on each instance
 
 A shortened example:
 
 Lets say I have an array of values (rather big), and then I loop
 through this array:
 
 for or foreach :
 {
$value = $arrValAll[$i];
 
echo test.$i.-- .$value;
 }
 
 
 When the script runs it will only start to echo values after certain
 period ... it does not echo immediately ... how can I force it start
 echo as soon as the first echo instance is done ? I thought ob_start
 does this but I have tried it and not getting what I want.
 
 Is there some other way/correct to do this?


call flush() after each echo to flush the buffer to the client.
That should work...

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] Re: ECHO

2006-12-19 Thread Satyam
You could use the PHP Compiler: http://phpcompiler.org/ and do a 
preprocessor as I did: http://www.satyam.com.ar/pht/.


PHC is capable of compiling a PHP source and return a modified PHP source. 
It is easy to make a plugin for any such modifications, there is a class 
which gets instantiated after parsing and makes a full tree traversal with a 
method defined for each node type so you simply inherit from the method for 
your particular tree node and make any modifications you want to it.


For PHC echo is not a language construct, you would have to override the 
method invocation method, check whether the function name is echo (print 
is translated to echo) and then do your changes.   One of the tutorials 
shows you how to do this:  http://phpcompiler.org/doc/tutorial2.html


Satyam


- Original Message - 
From: Fahad Pervaiz [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Tuesday, December 19, 2006 6:46 AM
Subject: [PHP] Re: ECHO


I have written a framework for internationalization. Now i have 
incoorperate

it into and existing system that is huge and it will take alot of time to
change ECHO to a function call, so i want to override its implementation 
so

that i can use it for my own purposes with having to change all the echo
calls

--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com



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



[PHP] Re: ECHO

2006-12-19 Thread Fahad Pervaiz

Thank you Satyam for you help! i think this is the rite solution

On 12/19/06, Satyam [EMAIL PROTECTED] wrote:


You could use the PHP Compiler: http://phpcompiler.org/ and do a
preprocessor as I did: http://www.satyam.com.ar/pht/.

PHC is capable of compiling a PHP source and return a modified PHP source.
It is easy to make a plugin for any such modifications, there is a class
which gets instantiated after parsing and makes a full tree traversal with
a
method defined for each node type so you simply inherit from the method
for
your particular tree node and make any modifications you want to it.

For PHC echo is not a language construct, you would have to override the
method invocation method, check whether the function name is echo
(print
is translated to echo) and then do your changes.   One of the tutorials
shows you how to do this:  http://phpcompiler.org/doc/tutorial2.html

Satyam


- Original Message -
From: Fahad Pervaiz [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, December 19, 2006 6:46 AM
Subject: [PHP] Re: ECHO


I have written a framework for internationalization. Now i have
incoorperate
 it into and existing system that is huge and it will take alot of time
to
 change ECHO to a function call, so i want to override its implementation
 so
 that i can use it for my own purposes with having to change all the echo
 calls

 --
 Regards
 Fahad Pervaiz
 www.ecommerce-xperts.com






--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com


[PHP] Re: ECHO

2006-12-18 Thread Fahad Pervaiz

I have written a framework for internationalization. Now i have incoorperate
it into and existing system that is huge and it will take alot of time to
change ECHO to a function call, so i want to override its implementation so
that i can use it for my own purposes with having to change all the echo
calls

--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com


Re: [PHP] Re: ECHO

2006-12-18 Thread Casey Chu

You could try to manipulate what the echo's output by ob_start(), etc.
Or maybe you could change the standard output?

On 12/18/06, Fahad Pervaiz [EMAIL PROTECTED] wrote:

I have written a framework for internationalization. Now i have incoorperate
it into and existing system that is huge and it will take alot of time to
change ECHO to a function call, so i want to override its implementation so
that i can use it for my own purposes with having to change all the echo
calls

--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com




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



[PHP] Re: ECHO

2006-12-18 Thread Fahad Pervaiz

Manipulating out with Output Control Functions sounds a good idea but it can
become cumbersome.

Do you know any good methods to control standard output??


On 12/19/06, Casey Chu [EMAIL PROTECTED] wrote:


You could try to manipulate what the echo's output by ob_start(), etc.
Or maybe you could change the standard output?

On 12/18/06, Fahad Pervaiz [EMAIL PROTECTED] wrote:
 I have written a framework for internationalization. Now i have
incoorperate
 it into and existing system that is huge and it will take alot of time
to
 change ECHO to a function call, so i want to override its implementation
so
 that i can use it for my own purposes with having to change all the echo
 calls

 --
 Regards
 Fahad Pervaiz
 www.ecommerce-xperts.com






--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com


Re: [PHP] Re: ECHO

2006-12-18 Thread Paul Novitski



On 12/18/06, Fahad Pervaiz [EMAIL PROTECTED] wrote:

I have written a framework for internationalization. Now i have incoorperate
it into and existing system that is huge and it will take alot of time to
change ECHO to a function call, so i want to override its implementation so
that i can use it for my own purposes with having to change all the echo
calls


At 12/18/2006 10:01 PM, Casey Chu wrote:

You could try to manipulate what the echo's output by ob_start(), etc.
Or maybe you could change the standard output?



Given the probably unalterable nature of echo, I'd say Casey's 
suggestion of buffering output and running it through a 
post-processor is an excellent one.  However my first choice would 
probably be to bite the bullet and globally replace echo with my own 
function.  Once that painful step is taken, you can modify the output 
methodology to your heart's content.


This sounds like an excellent object lesson in the separation of 
logic from markup.  If you design your applications to first figure 
out what to output and then to output it as one or more solid lumps, 
you can more easily tweak the logic or the markup or the output 
method without messing with the others.  It can be hard medicine to 
swallow the first time, but it will make you a leaner  cleaner coder.


Regards,
Paul 


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



[PHP] Re: echo

2005-11-19 Thread Oliver Grätz
Alex Alfonso schrieb:
 echo I need a space here;

echo space;

*g*

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



Re: [PHP] Re: Echo array string index?

2005-07-14 Thread Joe Harman
Hey Matt,
 you can print out the contents of your array by using print_r($arr)
 but more useful is using this
 foreach ($arr as $key = $value)
 {
 echo Key : .$key. Value : .$value;
}
 Adios
Joe
 On 7/13/05, Adam Hubscher [EMAIL PROTECTED] wrote: 
 
 Matt Darby wrote:
  I have an array setup as such: *$arr['generated text']='generated 
 number';*
 
  What would be the best way to echo the key in a loop?
  Seems pretty easy but I've never attempted...
 
  Thanks all!
  Matt Darby
 
 I'm not sure I understand the question.
 
 You could do foreach($arr as $key = $value) { print($key); }.
 
 There are also a number of functions that get the current key on the
 array's pointer:
 
 http://us2.php.net/manual/en/function.key.php
 http://us2.php.net/manual/en/function.array-keys.php
 
 But once again, it really comes down to what exactly it is you want to 
 do...
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Joe Harman
-
Do not go where the path may lead, go instead where there is no path and 
leave a trail. - Ralph Waldo Emerson


RE: [PHP] Re: Echo array string index?

2005-07-14 Thread yanghshiqi
Yeah, you can use foreach.
But *may be* you just find sth called array_keys().

 
 
 
Best regards,
Shiqi Yang

-Original Message-
From: Joe Harman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 14, 2005 4:45 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: Echo array string index?

Hey Matt,
 you can print out the contents of your array by using print_r($arr)
 but more useful is using this
 foreach ($arr as $key = $value)
 {
 echo Key : .$key. Value : .$value;
}
 Adios
Joe
 On 7/13/05, Adam Hubscher [EMAIL PROTECTED] wrote: 
 
 Matt Darby wrote:
  I have an array setup as such: *$arr['generated text']='generated 
 number';*
 
  What would be the best way to echo the key in a loop?
  Seems pretty easy but I've never attempted...
 
  Thanks all!
  Matt Darby
 
 I'm not sure I understand the question.
 
 You could do foreach($arr as $key = $value) { print($key); }.
 
 There are also a number of functions that get the current key on the
 array's pointer:
 
 http://us2.php.net/manual/en/function.key.php
 http://us2.php.net/manual/en/function.array-keys.php
 
 But once again, it really comes down to what exactly it is you want to 
 do...
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Joe Harman
-
Do not go where the path may lead, go instead where there is no path and 
leave a trail. - Ralph Waldo Emerson

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



[PHP] Re: Echo array string index?

2005-07-13 Thread Adam Hubscher

Matt Darby wrote:

I have an array setup as such: *$arr['generated text']='generated number';*

What would be the best way to echo the key in a loop?
Seems pretty easy but I've never attempted...

Thanks all!
Matt Darby


I'm not sure I understand the question.

You could do foreach($arr as $key = $value) { print($key); }.

There are also a number of functions that get the current key on the 
array's pointer:


http://us2.php.net/manual/en/function.key.php
http://us2.php.net/manual/en/function.array-keys.php

But once again, it really comes down to what exactly it is you want to do...

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



[PHP] Re: echo

2004-11-30 Thread Christopher Weaver
OK, I get it now.

I had forgotten that PHP output is text, as opposed to the result produced 
by HTML.  When the documentation states that the newlines will be output as 
well it means that literally -- not that the browser will output the 
newlines.

Thanks for jumping onto this.

Chris. 

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



[PHP] Re: echo to rtf format

2004-09-24 Thread Manuel Lemos
Hello,
On 09/24/2004 11:16 PM, John Taylor-Johnston wrote:
I know there is a way to print to pdf. Wh«t about rtf?
I'm getting real tired of doing it myself. Must be an easier answer?
You may want to try this RTF generator class:
http://www.phpclasses.org/rtfgenerator

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Echo HTML code Verses breaking out of ?php ?

2003-11-25 Thread Curt Zirzow
* Thus wrote tkwright ([EMAIL PROTECTED]):
 
 
 Just warming the timer
 This Is HTML
 ###
 # Total Time:   0.000114 seconds  #
 # Start Time:   1069732578.575586 seconds #
 # Ending Time:  1069732578.575700 seconds #
 ###

You need to do more than one iteration in your benchmark. There are
many factors that go into benchmarking that can easily give false
reports.

And situations differ on their performance, for example:

echo 'a';

vs.

?a?php


The echo will simply add the char 'a' to the output stack, while the
latter will have to break out of php add 'a' to the stack and
re-enter php.

 
 begin 666 inspect.timer.2.php

Attachments are strongly discourged on the list, if you wish to
share them put them on the website and post the links to them here.


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

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



[PHP] Re: Echo HTML code Verses breaking out of ?php ?

2003-11-24 Thread tkwright
I dont think you are going to belive this, but here are the results from a
php-class I made(for code see bottom of message):






Just warming the timer
This Is HTML
###
# Total Time:   0.000114 seconds  #
# Start Time:   1069732578.575586 seconds #
# Ending Time:  1069732578.575700 seconds #
###





with echo,single-quotes
This Is HTML
###
# Total Time:   0.48 seconds  #
# Start Time:   1069732578.575873 seconds #
# Ending Time:  1069732578.575921 seconds #
###





with echo,double-quotes
This Is HTML
###
# Total Time:   0.47 seconds  #
# Start Time:   1069732578.576062 seconds #
# Ending Time:  1069732578.576109 seconds #
###





with print,single-quotes
This Is HTML
###
# Total Time:   0.51 seconds  #
# Start Time:   1069732578.576299 seconds #
# Ending Time:  1069732578.576350 seconds #
###





with print,double-quotes
This Is HTML
###
# Total Time:   0.50 seconds  #
# Start Time:   1069732578.576491 seconds #
# Ending Time:  1069732578.576541 seconds #
###





with raw HTML
This Is HTML
###
# Total Time:   0.000177 seconds  #
# Start Time:   1069732578.576683 seconds #
# Ending Time:  1069732578.576860 seconds #
###





with just '?
###
# Total Time:   0.40 seconds  #
# Start Time:   1069732578.577006 seconds #
# Ending Time:  1069732578.577046 seconds #
###





with just ''

###
# Total Time:   0.67 seconds  #
# Start Time:   1069732578.577185 seconds #
# Ending Time:  1069732578.577252 seconds #
###

THE SCRIPT:
see attachment:
inspect.timer.2.php

THE PHP CLASS:
see attachment, or cun-n-paste:

?php
class timer{
 function timer(){}
 function starttimer(){
  $this-stimer = explode( ' ', microtime() );
  $this-stimer = $this-stimer[1] + $this-stimer[0];
 }
 function endtimer(){
  $this-etimer = explode( ' ', microtime() );
  $this-etimer = $this-etimer[1] + $this-etimer[0];
 }

 function printresults(){
  echo br /code###br /\n;
  printf( # Total Time:.str_repeat('nbsp;',3).%f
seconds.str_repeat('nbsp;',10).#br /\n,
($this-etimer-$this-stimer) );
  printf( # Start Time:.str_repeat('nbsp;',3).%f seconds #br /\n,
($this-stimer) );
  printf( # Ending Time:.str_repeat('nbsp;',2).%f seconds #br /\n,
($this-etimer) );
  echo ###/code\n;
 }
 function returnresults(){
  return ($this-etimer-$this-stimer);
 }
}
?


begin 666 inspect.timer.2.php
M/#]P:' -B1I;F-L=61ER ](%RF%Y*=I;G-P96-T+W1I;65R)RD[#0IR
M97%U:7)E7V]N8V4H)RXN+V)B92YI;F,NAP)RD[#0H_/CQH=UL/@T*/AE
M860^#0H\=ET;4^56YT:[EMAIL PROTECTED]]C=6UE;G0\+W1I=QE/@T*/UE=$@
M:'1TUE75I=CTB0V]N=5N=U47!E(B!C;VYT96YT/2)T97AT+VAT;6P[
M(-H87)S970]:[EMAIL PROTECTED],2(^#0H\V-R:7!T(QA;F=U86=E/2)*879A
M4V-R:7!T(B!T7!E/2)T97AT+TIA=F%38W)I'0B/@T*/$M+0T*9G5N8W1I
M;[EMAIL PROTECTED]F5L;V%D4%G92AI;FET*2![( O+W)E;]A9',@=AE('=I;F1O
M=R!I9B!.878T(')EVEZ960-B @:[EMAIL PROTECTED]EN:70]/71R=64I('=I=@@*YA
M=FEG871OBD@VEF(@H87!P3F%M93T](DYE='-C87!E(BDF)BAP87)S94EN
M=AA'!697)S:6]N*3T]-DI('L-B @(!D;V-U;65N=Y-35]P9U]:6YN
M97)7:61T:[EMAIL PROTECTED]]C=6UE;G0N34U?=(/6EN;F5R25I9VAT.R!O;G)EVEZ
M93U-35]R96QO861086=E.R!]?0T*(!E;'-E(EF(AI;FYEE=I9'1H(3UD
M;V-U;65N=Y-35]P9U@?'P@:6YN97)(96EG:'0A/61O8W5M96YT+DU-7W!G
M2D@;]C871I;VXNF5L;V%D*D[#0I]#0I-35]R96QO861086=E*'1R=64I
M.PT*+R\M+3X-CPOV-R:7!T/@T*/]H96%D/@T*#0H\8F]D3X-CP_AP
M#0HD=EM97(@/2!N97@=EM97(H*3L-@T*96-H;R B/AR/CQBCY*=7-T
M('1EW1I;F@=AE('1I;65R.CQBCXB.PT*)'1I;65R+3YS=%R='1I;65R
M*D[#0IE8VAO(\9F]N=!C;VQOCTB(S P,# Y.2(^/'-TF]N9SY4/]S
M=')O;F^/]F;VYT/CQF;VYT(-O;]R/2(C,# Y.3 P(CX\96T^:#PO96T^
M/]F;VYT/CQF;VYT(-O;]R/2(C.3E1C P(CX\W1R;VYG/CQE;3YI/]E
M;3X\+W-TF]N9SX\+V9O;G0^/5M/CQS=')O;F^/9O;[EMAIL 

[PHP] Re: Echo HTML code Verses breaking out of ?php ?

2003-11-21 Thread DvDmanDT
?HTML? is almost double as fast according to some stats I saw a while ago
(at phpbeginner.com).. But that's compared to HTML, using singlequotes is
faster ('HTML')... But I haven't confirmed those stats...
-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
##
Please, if you are using windows, you may be infected by Swen. Please go
here to find out more:
http://us.mcafee.com/virusInfo/default.asp?id=helpCenterhcName=swen
http://securityresponse.symantec.com/avcenter/venc/data/[EMAIL PROTECTED]
##
Joe Harman [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Hello,

 I would like some opinions, or hopefully facts on a few things... Maybe
 some people can help me out here.

 A friend of mine and I were discussing which is best way to use PHP
 building dynamic pages, here are the 2 methods we are comparing.. They
 are in the simplest terms here... But try to imagine a very intesive PHP
 appliaction with huge MySQL queries...


 First Item
 -
 table width=500 border=0 cellspacing=0 cellpadding=0
   tr
 td?php echo Hello World; ?/td
   /tr
 /table


 Second Item
 -
 ?php
 echo table width=\500\ border=\0\ cellspacing=\0\
 cellpadding=\0\;
   echo tr;
 echo tdHello World/td;
   echo /tr;
 echo /table;
 ?


 Now I would say that the first item is the most efficient simply because
 you are not making PHP process the ECHO of HTML code... It's more
 efficient to let the browser do that since it has to interperat it
 anyhow. Am I correct assuming this?

 Thanks!
 Joe

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



Re: [PHP] Re: Echo $PHP_SELF not working

2003-10-11 Thread Justin French
Actually, that should make no difference... you don't need a ; if it's 
the last instruction before the close of PHP.

Try ?php echo $_SEVER['PHP_SELF']? or ?=$_SEVER['PHP_SELF']?

Justin

On Saturday, October 11, 2003, at 09:29  AM, Al wrote:

Put a ; [no quotes] after  such as:   echo $PHP_SELF;
Jeff McKeon wrote:
I've just published a new website and something is wrong.  I suspect 
the
PHP.ini on the server but I can't seem to find anything.

The line:

form method='post' action='?PHP ECHO $PHP_SELF ?'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Echo $PHP_SELF not working

2003-10-10 Thread Paul van Schayck
Hello,
Here we go again ;)

[EMAIL PROTECTED] (Jeff McKeon) wrote
 I've just published a new website and something is wrong.  I suspect the
 PHP.ini on the server but I can't seem to find anything.

register_globals is on off. Which is a good idea, keep it there!


 On the dev server ECHO $PHP_SELF seems to work but not on the
 production one.  Any ideas what I've missed?

http://nl2.php.net/manual/en/reserved.variables.php#reserved.variables.serv
er

echo $_SERVER['PHP_SELF'];

Paul

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



RE: [PHP] Re: Echo $PHP_SELF not working

2003-10-10 Thread Jeff McKeon
So you're saying I had register_globals set to ON on my dev server!?
CRAP!!! I thought I was working with it off!

Now I have to redevelop it all and change all my $variables from forms
to $_POST['variable']? Even when they post to the same page with
action='?PHP ECHO $_SERVER['PHP_SELF']'??

Jeff


 -Original Message-
 From: Paul van Schayck [mailto:[EMAIL PROTECTED] 
 Sent: Friday, October 10, 2003 8:24 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Echo $PHP_SELF not working
 
 
 Hello,
 Here we go again ;)
 
 [EMAIL PROTECTED] (Jeff McKeon) wrote
  I've just published a new website and something is wrong.  
 I suspect 
  the PHP.ini on the server but I can't seem to find anything.
 
 register_globals is on off. Which is a good idea, keep it there!
 
 
  On the dev server ECHO $PHP_SELF seems to work but not on the 
  production one.  Any ideas what I've missed?
 
http://nl2.php.net/manual/en/reserved.variables.php#reserved.variables.s
erv
er

echo $_SERVER['PHP_SELF'];

Paul

-- 
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



Re: [PHP] Re: Echo $PHP_SELF not working

2003-10-10 Thread Shawn McKenzie
Unless you do an extract($_POST); in a main include somewhere before your
form.

For $PHP_SELF just do $PHP_SELF = $_SERVER['PHP_SELF']; or to get all of the
$_SERVER vars, do extract($_SERVER);

-Shawn


Jeff McKeon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
So you're saying I had register_globals set to ON on my dev server!?
CRAP!!! I thought I was working with it off!

Now I have to redevelop it all and change all my $variables from forms
to $_POST['variable']? Even when they post to the same page with
action='?PHP ECHO $_SERVER['PHP_SELF']'??

Jeff


 -Original Message-
 From: Paul van Schayck [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 10, 2003 8:24 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Echo $PHP_SELF not working


 Hello,
 Here we go again ;)

 [EMAIL PROTECTED] (Jeff McKeon) wrote
  I've just published a new website and something is wrong.
 I suspect
  the PHP.ini on the server but I can't seem to find anything.

 register_globals is on off. Which is a good idea, keep it there!


  On the dev server ECHO $PHP_SELF seems to work but not on the
  production one.  Any ideas what I've missed?

http://nl2.php.net/manual/en/reserved.variables.php#reserved.variables.s
erv
er

echo $_SERVER['PHP_SELF'];

Paul

-- 
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



[PHP] Re: Echo $PHP_SELF not working

2003-10-10 Thread Al
Put a ; [no quotes] after  such as:   echo $PHP_SELF;   

Jeff McKeon wrote:

I've just published a new website and something is wrong.  I suspect the
PHP.ini on the server but I can't seem to find anything.
The line:

form method='post' action='?PHP ECHO $PHP_SELF ?'

Doesn't seem to work.  If I look at the view source from the web
browser I see this..
form method='post' action=''

On the development server I see this...

form method='post' action='/auth_user.php'

On the dev server ECHO $PHP_SELF seems to work but not on the
production one.  Any ideas what I've missed?
Thanks,

Jeff
 

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


[PHP] Re: echo statements

2003-07-18 Thread Kevin Stone

Jay Fitzgerald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 When echoing html code that will include variables from a while or if
loop,
 which method is best?
  Method 1: echo td align=\left\ VALIGN=\top\font
 class=\dbtables\$employer/font/td;
  OR
  Method 2: td align=left valign=topfont class=dbtables?php echo
 $employer; ?/font/td
  If you would, please give reasons why to support your opinion.
  Thanks

Method 3:  font class=dbtables?= $employer;?/font
- Kevin



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



[PHP] re: echo w/ here document

2002-11-12 Thread Craig Buxton
I'm still having a problem with including a here document. Trying this 
code:

?php
echo ENDOFECHO
HTML
BODY
hello... hello... hello... hello...
/BODY
/HTML
ENDOFECHO;
?

I get a parse error on line 7. Please help. I have a major project that 
has ground to a halt.

Craig Buxton
Gravity Pilot Productions
[EMAIL PROTECTED]


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



Re: [PHP] re: echo w/ here document

2002-11-12 Thread Aaron Gould
Looks ok to me.  Try making sure that all white space is removed from after
the echo ENDOFECHO, and both before and after the ENDOFECHO; line.
Heredocs don't play nicely with white space...
--
Aaron Gould
[EMAIL PROTECTED]
Web Developer
Parts Canada


- Original Message -
From: Craig Buxton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 12, 2002 5:32 AM
Subject: [PHP] re: echo w/ here document


 I'm still having a problem with including a here document. Trying this
 code:

 ?php
 echo ENDOFECHO
 HTML
 BODY
 hello... hello... hello... hello...
 /BODY
 /HTML
 ENDOFECHO;
 ?

 I get a parse error on line 7. Please help. I have a major project that
 has ground to a halt.

 Craig Buxton
 Gravity Pilot Productions
 [EMAIL PROTECTED]


 --
 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




Re: [PHP] re: echo w/ here document

2002-11-12 Thread Marco Tabini
Works fine on my system. As Aaron said, make sure there are no spaces
around ENDOFECHO;


Marco

-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Tue, 2002-11-12 at 08:21, Aaron Gould wrote:
 Looks ok to me.  Try making sure that all white space is removed from after
 the echo ENDOFECHO, and both before and after the ENDOFECHO; line.
 Heredocs don't play nicely with white space...
 --
 Aaron Gould
 [EMAIL PROTECTED]
 Web Developer
 Parts Canada
 
 
 - Original Message -
 From: Craig Buxton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, November 12, 2002 5:32 AM
 Subject: [PHP] re: echo w/ here document
 
 
  I'm still having a problem with including a here document. Trying this
  code:
 
  ?php
  echo ENDOFECHO
  HTML
  BODY
  hello... hello... hello... hello...
  /BODY
  /HTML
  ENDOFECHO;
  ?
 
  I get a parse error on line 7. Please help. I have a major project that
  has ground to a halt.
 
  Craig Buxton
  Gravity Pilot Productions
  [EMAIL PROTECTED]
 
 
  --
  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
 



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




RE: [PHP] re: echo w/ here document

2002-11-12 Thread Troy May
Newbie here.  Works fine for me too.


-Original Message-
From: Marco Tabini [mailto:marcot;tabini.ca]
Sent: Tuesday, November 12, 2002 5:31 AM
To: Aaron Gould
Cc: Craig Buxton;
Subject: Re: [PHP] re: echo w/ here document


Works fine on my system. As Aaron said, make sure there are no spaces
around ENDOFECHO;


Marco

--

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com

On Tue, 2002-11-12 at 08:21, Aaron Gould wrote:
 Looks ok to me.  Try making sure that all white space is removed from
after
 the echo ENDOFECHO, and both before and after the ENDOFECHO; line.
 Heredocs don't play nicely with white space...
 --
 Aaron Gould
 [EMAIL PROTECTED]
 Web Developer
 Parts Canada


 - Original Message -
 From: Craig Buxton [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, November 12, 2002 5:32 AM
 Subject: [PHP] re: echo w/ here document


  I'm still having a problem with including a here document. Trying this
  code:
 
  ?php
  echo ENDOFECHO
  HTML
  BODY
  hello... hello... hello... hello...
  /BODY
  /HTML
  ENDOFECHO;
  ?
 
  I get a parse error on line 7. Please help. I have a major project that
  has ground to a halt.
 
  Craig Buxton
  Gravity Pilot Productions
  [EMAIL PROTECTED]
 
 
  --
  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




--
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




[PHP] Re: Echo Regular Expression Pattern

2002-10-10 Thread Mike Smith

Nevermind.

This works:

ereg(Q+[0-9]{6},$Data[$n],$qarticle);
$GetLine = explode(\r, ereg_replace(Q+[0-9]{6},a
href=\http://support.microsoft.com/default.aspx?scid=kb;[LN];$qarticle[0]\;
target=\blank\$qarticle[0]/a,$Data[$n]));





Mike Smith [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm trying to return a pattern found in a regular expression. I can find
the
 Expression (Q followed by 6 numbers, yes MS Q articles) using this:

 $GetLine = explode(\r, ereg_replace(Q+[0-9]{6},a
 href=\http://support.microsoft.com/default.aspx?scid=kb;[LN];Q+[0-9]{6}\;
 target=\blank\'Q+[0-9]{6}'/a,$Data[$n]));

 I'm basically trying to find the pattern and 'replace' it with itself as a
 clickable link to MS's Q articles so I need to insert Q+[0-9]{6} after
 [LN]; in the href and then again as the text of the link. The script runs
 but produces:

 http://support.microsoft.com/default.aspx?scid=kb;[LN];Q+[0-9]{6} and
echos
 Q+[0-9]{6} as the clickable link.

 Thanks,
 Mike Smith





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




[PHP] Re: echo HTML code ;

2002-01-31 Thread Daniel Grace


André wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a PHP file that I show values of variables in several parts, and
for
 that I put in almost the whole page

 echo... HTML code + PHP codes (variables, functions, etc.) + HTML code...
 ;


 I don't know nor why I put, I think it went to not to be finishing and
 beginning PHP parts as:

 ?php echo$variable; PHP functions; etc.? HTML code ?php
 echo$variable; PHP functions; etc.? HTML code ?php echo$variável;
PHP
 functions; etc.? HTML code

 Can these several echo's harm the processing of the server?  Can that turn
 slow the visualization of the page? Should I remove the maximum possible
of
 echo... HTML Code ... ; or can I leave how it is?

 André

Not using echo IS faster, but the difference is barely noticeable. If you're
outputting lots of PHP variables, your current way is fine.

By the way, you may wish to consider using 'here documents':

echo XYZZY
Here documents are nice. They work like doubly-quoted strings do,
only you don't need to escape any of the quotes, single or double.
They can also do $variable expansion and all those are nice things
(escape your \$-signs if you use them for anything else),
and of course html will work just fine. For more about
Here Documents, take a look at here:
http://www.php.net/manual/en/language.types.string.php
XYZZY;


-- Daniel Grace



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: echo/printing html within a function - best method

2001-09-16 Thread speedboy

  How do you echo your html, do you put the html in your functions and
  escape the double quotes? There is some extra load there echoing all the
  html?
 
 echo HTML?  I do this:
 
   ? php stuff..?
   HTML stuff
   ? more php stuff ?
 
 I drop out of PHP mode to display raw HTML.  If I have a lot of HTML with
 a lot of PHP variables tossed in, I do:
 
   ?
$test = 'test';
$one = 'one';
echo EOF
This is a $test.
And here is another $one.
   EOF;
..more php code...
  ?

I meant to say, in your functions, do you use the same as above echo EOF ...

Thanks.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: echo/printing html within a function - best method

2001-09-16 Thread Rasmus Lerdorf

   How do you echo your html, do you put the html in your functions and
   escape the double quotes? There is some extra load there echoing all the
   html?
 
  echo HTML?  I do this:
 
? php stuff..?
HTML stuff
? more php stuff ?
 
  I drop out of PHP mode to display raw HTML.  If I have a lot of HTML with
  a lot of PHP variables tossed in, I do:
 
?
 $test = 'test';
 $one = 'one';
 echo EOF
 This is a $test.
 And here is another $one.
EOF;
 ..more php code...
   ?

 I meant to say, in your functions, do you use the same as above echo EOF ...

I try to avoid having my functions generate HTML.  But yes, when they do I
use the same approach.  You can have functions that look like this:

   ? function foo() {?
 HTML Stuff
   ? } ?

That is, a function that does nothing but output HTML.

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: echo/printing html within a function - best method

2001-09-16 Thread Jason Bell

Out of curiosity, why do you avoid having functions generate HTML?  Is this
just personal preference, or is there some performance or other reason?

-Jason

- Original Message -
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: speedboy [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, September 16, 2001 9:32 PM
Subject: Re: [PHP] Re: echo/printing html within a function - best method


 I try to avoid having my functions generate HTML.  But yes, when they do I
 use the same approach.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: echo vs printf

2001-07-17 Thread brother

Steve Brett wrote:
 
 don't echo and printf do different jobs ?
 
 as i understand it echo will dump anything to screen, fprint will accept
 formatted text args like you owe me %d dollars,$owed_amount) or something
 like that.
 
 i kind of use print by itself (harking back to the old days of basic etc)
 but use echo quite a lot. only use printf when i have to put cash amounts in
 and stuff like that.
 
 Steve

printf ();
echo ;
print ();

They do the same but why?

The question that drives us (nice quote!) is if we gain any speed to use
one another or if it is too little to be measured.

/brother (now cced to the list too =))


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: echo vs printf

2001-07-16 Thread Steve Brett

don't echo and printf do different jobs ?

as i understand it echo will dump anything to screen, fprint will accept
formatted text args like you owe me %d dollars,$owed_amount) or something
like that.

i kind of use print by itself (harking back to the old days of basic etc)
but use echo quite a lot. only use printf when i have to put cash amounts in
and stuff like that.

Steve

Brother [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Why should I use printf instead of echo and vice versa?

 As for today I use printf mostly but I don't know why.

 brother
 Mail: [EMAIL PROTECTED]
 UIN: 4722160
 Web: http://motd.st




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: echo vs printf

2001-07-16 Thread Gonyou, Austin

print, echo, and printf are all available to help different coders code in
their own style. So if you're used to just using echo in shell, or print
in perl/basic or perhaps printf, in c/c++/java/asp, there you go. Make a
language easy to get stuff out of, and you can have a really quick user
base. 

-- 
Austin Gonyou
Systems Architect, CCNA
Coremetrics, Inc.
Phone: 512-796-9023
email: [EMAIL PROTECTED] 

 -Original Message-
 From: Steve Brett [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 16, 2001 10:38 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: echo vs printf
 
 
 don't echo and printf do different jobs ?
 
 as i understand it echo will dump anything to screen, fprint 
 will accept
 formatted text args like you owe me %d 
 dollars,$owed_amount) or something
 like that.
 
 i kind of use print by itself (harking back to the old days 
 of basic etc)
 but use echo quite a lot. only use printf when i have to put 
 cash amounts in
 and stuff like that.
 
 Steve
 
 Brother [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Why should I use printf instead of echo and vice versa?
 
  As for today I use printf mostly but I don't know why.
 
  brother
  Mail: [EMAIL PROTECTED]
  UIN: 4722160
  Web: http://motd.st
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]