RE: [PHP-DB] Putting a string into a variable.

2003-03-28 Thread Jennifer Goodie
The part where $i is never equal to 1 might be the problem.  You might want
to try incrementing your sentinel when using loops.

-Original Message-
From: Info_Best-IT [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 11:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Putting a string into a variable.


I am having problems putting an html string into a variable to create an
array of
strings.

something like this:


$stringarray[] = array();
$i = 0;

while ( $i  6 ){
$stringarray[$i] = table
cellspacing=\0\trtd.$this-differentarray[0]
[0]./td/tr/table;
}


When I echo $stringarray[1] it comes up empty...  Is there a special trick
to get a
string into an array or even store one as a variable.

thanks,
/Tim

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


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



RE: [PHP-DB] Putting a string into a variable.

2003-03-28 Thread Hutchins, Richard
You might be getting an empty result because you don't have anything in
$stringarray[1]. You set $i = 0 then have a while loop that does something
while $i  6. But you never go through and increment $i at all so it's
always equal to 0. You might get some type of result if you echoed
$stringarray[0] in that case.

You should use a for loop and remember to increment ($i++) the variable in
the appropriate place inside the for loop.

Additionally, I think the proper way to accomplish your array assignment is
to state $stringarray = array(). I seem to remember reading somewhere that
$stringarray[] = array() isn't quite correct. It works, but it's not
correct.

It's Friday, it's nice outside and I'm not concentrating much, so I hope
this information is of some help.

Good luck,
Rich

 -Original Message-
 From: Info_Best-IT [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 2:13 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Putting a string into a variable.
 
 
 I am having problems putting an html string into a variable 
 to create an array of 
 strings.  
 
 something like this:
 
 
 $stringarray[] = array();
 $i = 0;
 
 while ( $i  6 ){
 $stringarray[$i] = table 
 cellspacing=\0\trtd.$this-differentarray[0]
 [0]./td/tr/table;
 }
 
 
 When I echo $stringarray[1] it comes up empty...  Is there a 
 special trick to get a 
 string into an array or even store one as a variable.
 
 thanks, 
 /Tim
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



RE: [PHP-DB] Putting a string into a variable.

2003-03-28 Thread Hutchins, Richard
I found what I remembered reading. If you're curious, go here:
http://www.php.net/manual/en/language.types.array.php

and scroll down to the Array Do's and Don'ts section. Don't know if it
actually does pertain to what you're doing, but it IS what I was thinking
of.

 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 2:22 PM
 To: 'Info_Best-IT'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Putting a string into a variable.
 
 
 You might be getting an empty result because you don't have 
 anything in
 $stringarray[1]. You set $i = 0 then have a while loop that 
 does something
 while $i  6. But you never go through and increment $i at all so it's
 always equal to 0. You might get some type of result if you echoed
 $stringarray[0] in that case.
 
 You should use a for loop and remember to increment ($i++) 
 the variable in
 the appropriate place inside the for loop.
 
 Additionally, I think the proper way to accomplish your array 
 assignment is
 to state $stringarray = array(). I seem to remember reading 
 somewhere that
 $stringarray[] = array() isn't quite correct. It works, but it's not
 correct.
 
 It's Friday, it's nice outside and I'm not concentrating 
 much, so I hope
 this information is of some help.
 
 Good luck,
 Rich
 
  -Original Message-
  From: Info_Best-IT [mailto:[EMAIL PROTECTED]
  Sent: Friday, March 28, 2003 2:13 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Putting a string into a variable.
  
  
  I am having problems putting an html string into a variable 
  to create an array of 
  strings.  
  
  something like this:
  
  
  $stringarray[] = array();
  $i = 0;
  
  while ( $i  6 ){
  $stringarray[$i] = table 
  cellspacing=\0\trtd.$this-differentarray[0]
  [0]./td/tr/table;
  }
  
  
  When I echo $stringarray[1] it comes up empty...  Is there a 
  special trick to get a 
  string into an array or even store one as a variable.
  
  thanks, 
  /Tim
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Putting a string into a variable.

2003-03-28 Thread Ronan Chilvers
Hi Tim

Comments inline...

 
 $stringarray[] = array();
 $i = 0;
 
 while ( $i  6 ){
 $stringarray[$i] = table cellspacing=\0\trtd.$this-differentarray[0]
 [0]./td/tr/table;
 }
 
 
 When I echo $stringarray[1] it comes up empty...  Is there a special trick to get a 

You're not incrementing $i.  You need $i++ in your while loop.

 
 thanks, 
 /Tim
 


-- 
Ronan
e: [EMAIL PROTECTED]
t: 01903 739 997
w: www.thelittledot.com

The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley

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