RE: [PHP] re: array question

2001-09-18 Thread Jack Dempsey

perhaps i'm misunderstanding you, but why not use a for loop?

for($i=0;$icount($array)-1;$i++){
echo $array[$i];
}

jack

-Original Message-
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 18, 2001 10:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP] re: array question


Oh, that works wonders and for the first time in 24 hours I am
smiling!  One more
thing to make it complete.  Is there a way to loop through the display of
that array?
In other words, I now have an array called $new_data and can call each
element in
the array by doing $new_data[0], etc, but I need to loop through everything
in the
array to display the navigation.

 At 08:54 PM 9/18/2001 -0400, you wrote:
 so then that last line in the loop should be
 $new_data[] = $ln;
 During the loop, everytime it comes to this line, $ln is added to the
array new_data.  Eventually, you will be able to call on the array
elements by $new_data[0], $new_data[1], etc


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




RE: [PHP] re: array question

2001-09-18 Thread Scott

Jack-

Thanks for the response, but I don't want to echo the array, I want to
bundle it into a new variable that will be called as part of a str_replace.
The array is created from a loop through all the navigation items in a 
database.
The code is below, if I echo the code is formatted in the wrong area on the
page.

$temp5 = str_replace([LEFT NAV],$new_data[3],$temp4);

At 10:29 PM 9/18/2001 -0400, you wrote:
perhaps i'm misunderstanding you, but why not use a for loop?

for($i=0;$icount($array)-1;$i++){
 echo $array[$i];
}

jack

-Original Message-
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 18, 2001 10:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP] re: array question


Oh, that works wonders and for the first time in 24 hours I am
smiling!  One more
thing to make it complete.  Is there a way to loop through the display of
that array?
In other words, I now have an array called $new_data and can call each
element in
the array by doing $new_data[0], etc, but I need to loop through everything
in the
array to display the navigation.

  At 08:54 PM 9/18/2001 -0400, you wrote:
  so then that last line in the loop should be
  $new_data[] = $ln;
  During the loop, everytime it comes to this line, $ln is added to the
array new_data.  Eventually, you will be able to call on the array
elements by $new_data[0], $new_data[1], etc


-- 
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: array question

2001-09-18 Thread Jason Bell

or, assuming PHP4 is in use,  you can do it a little cleaner, and use a
foreach loop:

foreach ($array as $value) {
print $value;
}

if you wanted the key names, as well as the value, you could use this:

foreach ($array as $key = $value) {
print $key of \$array = $value;
}

- Original Message -
From: Jack Dempsey [EMAIL PROTECTED]
To: Scott [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, September 18, 2001 7:29 PM
Subject: RE: [PHP] re: array question


 perhaps i'm misunderstanding you, but why not use a for loop?

 for($i=0;$icount($array)-1;$i++){
 echo $array[$i];
 }

 jack

 -Original Message-
 From: Scott [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 18, 2001 10:11 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] re: array question


 Oh, that works wonders and for the first time in 24 hours I am
 smiling!  One more
 thing to make it complete.  Is there a way to loop through the display of
 that array?
 In other words, I now have an array called $new_data and can call each
 element in
 the array by doing $new_data[0], etc, but I need to loop through
everything
 in the
 array to display the navigation.

  At 08:54 PM 9/18/2001 -0400, you wrote:
  so then that last line in the loop should be
  $new_data[] = $ln;
  During the loop, everytime it comes to this line, $ln is added to the
 array new_data.  Eventually, you will be able to call on the array
 elements by $new_data[0], $new_data[1], etc


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




-- 
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: array question

2001-09-18 Thread Scott

That works, thank you, but it prints at the top of my page, is there
a way to store that array into a single variable?





At 07:43 PM 9/18/2001 -0700, Jason Bell wrote:
or, assuming PHP4 is in use,  you can do it a little cleaner, and use a
foreach loop:

foreach ($array as $value) {
 print $value;
}

if you wanted the key names, as well as the value, you could use this:

foreach ($array as $key = $value) {
 print $key of \$array = $value;
}

- Original Message -
From: Jack Dempsey [EMAIL PROTECTED]
To: Scott [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, September 18, 2001 7:29 PM
Subject: RE: [PHP] re: array question


  perhaps i'm misunderstanding you, but why not use a for loop?
 
  for($i=0;$icount($array)-1;$i++){
  echo $array[$i];
  }
 
  jack
 
  -Original Message-
  From: Scott [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, September 18, 2001 10:11 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] re: array question
 
 
  Oh, that works wonders and for the first time in 24 hours I am
  smiling!  One more
  thing to make it complete.  Is there a way to loop through the display of
  that array?
  In other words, I now have an array called $new_data and can call each
  element in
  the array by doing $new_data[0], etc, but I need to loop through
everything
  in the
  array to display the navigation.
 
   At 08:54 PM 9/18/2001 -0400, you wrote:
   so then that last line in the loop should be
   $new_data[] = $ln;
   During the loop, everytime it comes to this line, $ln is added to the
  array new_data.  Eventually, you will be able to call on the array
  elements by $new_data[0], $new_data[1], etc
 
 
  --
  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]
 
 


-- 
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: array question

2001-09-18 Thread Hoover, Josh

If you want to store all the values in the array in one variable (just as a
string with delimiters maybe?) Try this:

foreach ($array as $value) {
$temp .= $value . |;
}

Josh Hoover
KnowledgeStorm, Inc.
[EMAIL PROTECTED]

Searching for a new IT solution for your company? Need to improve your
product marketing? 
Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify
the process for you.
KnowledgeStorm - Your IT Search Starts Here 

 
 foreach ($array as $value) {
  print $value;
 }
 
 if you wanted the key names, as well as the value, you could 
 use this:
 
 foreach ($array as $key = $value) {
  print $key of \$array = $value;
 }



Re: [PHP] re: array question

2001-09-18 Thread David Robley

On Wed, 19 Sep 2001 12:28, Scott wrote:
 That works, thank you, but it prints at the top of my page, is there
 a way to store that array into a single variable?


Yes - implode()

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   A day without radiation is a day without sunshine.

-- 
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: array question

2001-09-18 Thread Scott

Thank YOU!  It worked wonderful, I used a blank to separate the
content like this:  $displn = implode(,$new_data);

Thank you again and thank you to everyone for helping me through this!


At 01:15 PM 9/19/2001 +0930, David Robley wrote:
On Wed, 19 Sep 2001 12:28, Scott wrote:
  That works, thank you, but it prints at the top of my page, is there
  a way to store that array into a single variable?
 

Yes - implode()

--
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA

A day without radiation is a day without sunshine.


-- 
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: array question

2001-07-19 Thread Ryan Fischer

You wrote:
 Also, consider using print or echo as opposed to printf.  And lastly,
you
 really don't need to use mysql_free_result, PHP does this
automagically
 after the script dies.  Sorry for picking on you, you may have your
 reasons. ;-)

Really?  Then why was it that, when I neglected to use
mysql_free_result() in some of my scripts, lots of memory was eaten up
because of lingering results?

--
 -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/



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