Re: Equivelant to mysql_fetch_row for normal array

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

 



the foreach loop is probably better (it doesn't require
reset()ing the array pointer for instance) but you should also
look at the example on this page (using the current() function in a
while loop):

	http://php.net/key


Dave M G wrote:
> PHP List,
> 
> Very frequently I use mysql_fetch_row in a while statement to
> 
> while($variable = mysql_fetch_row($mysqlResult)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> Pretty standard.
> 
> But what do I do when I want to do the same kind of while loop not with
> a MySQL result, but with just a regular array?
> 
> while (variable = ????($array)){
> echo $variable[text1];
> echo $variable[text2];
> }
> 
> I've been up and down the manual, and looked at foreach statements and
> functions like each(), but I can't seem to zero in on what I need.
> 
> Can anyone let me know what it is I'm missing?
> 
> Thank you for any advice.
> 
> -- 
> Dave M G
> 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux