Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Maurice Rickard
At 5:22 PM -0500 1/17/01, Ignacio Vazquez-Abrams wrote: > >Um, no. $relationsresult isn't an array, it's a MySQL result resource. Use >mysql_data_seek() instead. > Ah! I get it! mysql_data_seek($relationsresult,0); does what I need it to do. Thanks, everyone! -Maurice -- Maurice Ric

Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Darryl Friesen
Getting off topic maybe so I'll keep it short. > The array pointer can be pretty useful. True, but unexpected for the perl programmer/novice PHP geek. > ie. give me the second last element of an array: This can be done in perl ("standard" arrays) with $array[@array-2] > Or have it tell you w

Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Maurice Rickard
At 4:22 PM -0600 1/17/01, Darryl Friesen wrote: >> $relationsresult = mysql_query($relationsquery) or die(mysql_error()); >> >> while ($relationsrow = mysql_fetch_array($relationsresult)) { >> >> $thischild = $relationsrow["childsku"]; >> if ($thevalue == $thischild) { >> echo " checked"; >>

Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Ignacio Vazquez-Abrams
On Wed, 17 Jan 2001, Maurice Rickard wrote: > Thanks! This is starting to make sense...although when I try to > reset what I thought was my array, I get the "Variable passed to > reset() is not an array or object" error message. Here's the > relevant code: > > $relationsquery = "select * from r

Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Darryl Friesen
> $relationsresult = mysql_query($relationsquery) or die(mysql_error()); > > while ($relationsrow = mysql_fetch_array($relationsresult)) { > > $thischild = $relationsrow["childsku"]; > if ($thevalue == $thischild) { > echo " checked"; > } > > } // end while for relations loop > > reset($relationsr

Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Maurice Rickard
Thanks! This is starting to make sense...although when I try to reset what I thought was my array, I get the "Variable passed to reset() is not an array or object" error message. Here's the relevant code: $relationsquery = "select * from relations where childtype='$childtype' and parenttype

Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Rasmus Lerdorf
> > What I'm getting is that the inner while loop executes on the first > > execution of the outer while, and then not at all. How would I get > > it to execute each time? > > Coming from a perl background, I got stuck there too when I started using > PHP. PHP has this odd notion of an array poi

Re: [PHP] Weird nested while loop problem

2001-01-17 Thread Darryl Friesen
> What I'm getting is that the inner while loop executes on the first > execution of the outer while, and then not at all. How would I get > it to execute each time? Coming from a perl background, I got stuck there too when I started using PHP. PHP has this odd notion of an array pointer. Afte

[PHP] Weird nested while loop problem

2001-01-17 Thread Maurice Rickard
In my attempt to simulate array_intersect in PHP3, I tried nesting while statements. While traversing one array to display checkboxes, I wanted to loop through another array, testing to see if any of the values in it match the current value in the outer while loop. What I'm getting is that th