Re: Weird nested while loop problem

From: Date: Wed, 17 Jan 2001 22:22:32 +0000
Subject: Re: Weird nested while loop problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35182@lists.php.net to get a copy of this message
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 relations where > childtype='$childtype' and parenttype='$parenttype' and > parentsku='$parentsku'"; > > $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($relationsresult); Um, no. $relationsresult isn't an array, it's a MySQL result resource. Use mysql_data_seek() instead. > Thanks again for your help so far! > Maurice > -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.general (#35182) next »