Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-23 Thread Jochem Maas
Dave M G wrote: > Nicolas, Jochem, Tul, > > I have been going mental, reading the online manual and trying different > things. I can not get this loop to work. > > Please understand that I have endeavored to read up on list(), each(), > foreach(), while(). key(), and everything else I can. I've e

Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-23 Thread Dave M G
Nicolas, Jochem, Tul, I have been going mental, reading the online manual and trying different things. I can not get this loop to work. Please understand that I have endeavored to read up on list(), each(), foreach(), while(). key(), and everything else I can. I've even looked at online tuto

Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Adam Zey
Dave M G wrote: Jochem, Tul, Nicolas, Thank you for your help. I must be doing something wrong with how my array is generated. It's actually just a MySQL result, but because it is returned from a function, it does not seem to behave as I would expect a MySQL result should. I'm trying the f

Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Dave M G
Jochem, Tul, Nicolas, Thank you for your help. I must be doing something wrong with how my array is generated. It's actually just a MySQL result, but because it is returned from a function, it does not seem to behave as I would expect a MySQL result should. I'm trying the foreach function a

Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Jochem Maas
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]; another thing. $variable[text2] is bad because you very likely don't have a constant in your code

Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Jochem Maas
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_ro

Re: [PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread nicolas figaro
Dave M G a écrit : PHP List, 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]; } did you try something like this ? foreach ($

[PHP] Equivelant to mysql_fetch_row for normal array

2006-06-22 Thread Dave M G
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 re