On 12/07/05, virtualsoftware@xxxxxxxxx <virtualsoftware@xxxxxxxxx> wrote: > Hi, > > How can i destroy an array? > I mean i have a loop and for each new value in the loop i want to destroy the array. Something like that: > > while($row = mysql_fetch_array($result)) > { > > $product[] = $product_id; > > // some code here > > } > > I've tried this but doesn't work > > while($row = mysql_fetch_array($result)) > { > > $product = array(); > > $product[] = $product_id; > > // some code here > > } To destroy an array? First of all, where does $product_id come from? You gave us no code that gives us that. Second, if you're trying to make an array populated with a feild from each row returned, your first example will work, but not the second. The second example will empty the array, and start a new one (which doesn't make sense to me why you would do that--because in the end, you're only going to have the array with the last row returned). But if you're trying to destroy an array doing either: unset($an_array) or $an_array = array(); will do the job. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php