RE: Putting a string into a variable.

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

 



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:Richard.Hutchins@Getingeusa.com]
> Sent: Friday, March 28, 2003 2:22 PM
> To: 'Info_Best-IT'; php-db@lists.php.net
> Subject: RE:  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:info@best-it.biz]
> > Sent: Friday, March 28, 2003 2:13 PM
> > To: php-db@lists.php.net
> > Subject:  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\"><tr><td>".$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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux