Re: [PHP] Loop Question

2003-10-18 Thread Robert Cummings
See changes below.

Cheers,
Rob.

On Sat, 2003-10-18 at 14:57, Jed R. Brubaker wrote:
 Hi! I am trying to loop through two different database calls with two for
 statements, one embedded in the other.
 
for ($i; $i  $codeset_rows; $i++)

 for ($i = 0; $i  $codeset_rows; $i++)

 {
 $codeset_row = $this-database-fetch_array($codeset_query);
 $codesys_query = $this-database-query(select
 codesys.codesys_index,
 
 codesys.code_name,
 
 codesys.code_value
 
 from   codesys
 
 where  codesys.codeset_ID = .$codeset_row['codeset_ID']);
 
 $codesys_rows = $this-database-num_rows($codesys_query);
 
 for ($j; $j  $codesys_rows; $j++)

  for ($j = 0; $j  $codesys_rows; $j++)

 {
 echo Blah, blah, blah;
 }
 
 }
 
 The current set up means that the first loop should cycle twice, and the
 second loop should cycle 6 times the first time and 2 times the second.
 
 So here is the question: $j doesn't unset when the loop ends. So when it
 comes around the second time, $j still = 6 and since $codesys_rows = 2, it
 skips the loop. I can fix this by putting an
 if ($j)
 {unset($j);}
 right before the second loop. However, it seems that there should be some
 more efficient way to do this.
 Ideas?
 
 Thanks!
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Loop Question

2003-10-18 Thread Jed R. Brubaker
Well duh. Thanks so much!

Robert Cummings [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 See changes below.

 Cheers,
 Rob.

 On Sat, 2003-10-18 at 14:57, Jed R. Brubaker wrote:
  Hi! I am trying to loop through two different database calls with two
for
  statements, one embedded in the other.
 
 for ($i; $i  $codeset_rows; $i++)

  for ($i = 0; $i  $codeset_rows; $i++)

  {
  $codeset_row = $this-database-fetch_array($codeset_query);
  $codesys_query = $this-database-query(select
  codesys.codesys_index,
 
  codesys.code_name,
 
  codesys.code_value
 
  from   codesys
 
  where  codesys.codeset_ID = .$codeset_row['codeset_ID']);
 
  $codesys_rows = $this-database-num_rows($codesys_query);
 
  for ($j; $j  $codesys_rows; $j++)

   for ($j = 0; $j  $codesys_rows; $j++)

  {
  echo Blah, blah, blah;
  }
 
  }
 
  The current set up means that the first loop should cycle twice, and the
  second loop should cycle 6 times the first time and 2 times the second.
 
  So here is the question: $j doesn't unset when the loop ends. So when it
  comes around the second time, $j still = 6 and since $codesys_rows = 2,
it
  skips the loop. I can fix this by putting an
  if ($j)
  {unset($j);}
  right before the second loop. However, it seems that there should be
some
  more efficient way to do this.
  Ideas?
 
  Thanks!
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'

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



RE: [PHP] -loop question-

2002-03-04 Thread Richard Black

I'm assuming you want to send a list of passengers as the body of the text.

Surely you want to do something like:

$body = '';
for ($i = 0; $i  $passengerNumberl ++$i)  {
  $body .= $Name_Passenger_[$i].'\n';
  }

mail ($to, $subj, $body, $header);


IE Prepare the list of passengers first, and then use that string as the
message body???

HTH,

Richy

==
Richard Black
Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 435 3504
Email: [EMAIL PROTECTED]

-Original Message-
From: Richard Bradley [mailto:[EMAIL PROTECTED]]
Sent: 04 March 2002 13:54
To: [EMAIL PROTECTED]
Subject: [PHP] -loop question-


I want to run a loop inside of the body section of the mail() function.

// CODE SNIPPLET //
mail ($to, $subj,
for ($i = 0; $i  $passengerNumber; ++$i) {
$Name_Passenger_[$i]

}
, $header);
// ***END CODE SNIPPLET *//


I can't seem to run the loop inside a variable either. Any suggestions?


--
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] -loop question-

2002-03-04 Thread Richard Black

Ooops... 
$i  $passengerNumberl 

should of course read

$i  $passengerNumber;

But you guessed that anyway, right???

Richy


-Original Message-
From: Richard Black [mailto:[EMAIL PROTECTED]]
Sent: 04 March 2002 14:03
To: Richard Bradley; [EMAIL PROTECTED]
Subject: RE: [PHP] -loop question-


I'm assuming you want to send a list of passengers as the body of the text.

Surely you want to do something like:

$body = '';
for ($i = 0; $i  $passengerNumberl ++$i)  {
  $body .= $Name_Passenger_[$i].'\n';
  }

mail ($to, $subj, $body, $header);


IE Prepare the list of passengers first, and then use that string as the
message body???

HTH,

Richy

==
Richard Black
Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 435 3504
Email: [EMAIL PROTECTED]

-Original Message-
From: Richard Bradley [mailto:[EMAIL PROTECTED]]
Sent: 04 March 2002 13:54
To: [EMAIL PROTECTED]
Subject: [PHP] -loop question-


I want to run a loop inside of the body section of the mail() function.

// CODE SNIPPLET //
mail ($to, $subj,
for ($i = 0; $i  $passengerNumber; ++$i) {
$Name_Passenger_[$i]

}
, $header);
// ***END CODE SNIPPLET *//


I can't seem to run the loop inside a variable either. Any suggestions?


--
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] -loop question-

2002-03-04 Thread bvr

Nope, you can't, use the loop to create a temp variable containing the 
message,

or do this:

mail($to, $subj, implode(\n, $Name_Passenger_), $header);

bvr

Richard Bradley wrote:

I want to run a loop inside of the body section of the mail() function

// CODE SNIPPLET //
mail ($to, $subj,
for ($i = 0; $i  $passengerNumber; ++$i) {
$Name_Passenger_[$i]

}
, $header);
// ***END CODE SNIPPLET *//


I can't seem to run the loop inside a variable either Any suggestions?






-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp