Re: dynamic list box

From: Date: Mon, 24 Feb 2003 14:02:27 +0000
Subject: Re: dynamic list box
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136902@lists.php.net to get a copy of this message
At 15:01 24/02/03, you wrote:
Hello, I have an sql statement that pulls data into a dynamic list box, the problem is, I have this list box twice on my form, since the query returns a lot of rows, I do not want to have the query executed twice but I populate my list box using the while loop so when it is time for the second list box, the query is already at end of file. I tried to get my result then just copy that to another array but that doesn't seem to work, any one have any ideas? i think your problem is that after you did an array operation often the array pointer moves along, and at the end of a walkthrough over the array, the arraypointer is at the end.
reset($array) between the two operations should work, this does not empty the array but only sets the pointer to the first element. I would recommend to use it every time before you walk through an array. http://www.php.net/manual/en/function.reset.php

« previous php.general (#136902) next »