note 30178 added to function.array

From: Date: Sun, 09 Mar 2003 20:12:16 +0000
Subject: note 30178 added to function.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-45040@lists.php.net to get a copy of this message
I've found that for some reason when I try to access an array after doing a mysql_query() the array no longer exists. This is not good! Here's what it looks like: while($retval < ($searchresults * $loopval)){ reset($goturl); $showurl = $goturl[$retval]; echo $showurl; $showthem = mysql_query("SELECT * FROM search WHERE url_id = '$showurl'"); $showrslt = mysql_fetch_row($showthem); When $showurl appears in the browser from the echo it is the last element in the array. This is interesting since I reset the array just before getting $showurl. Then, once it hits the query the array is either empty, or gone completely. I know the array has elements in it because I'm doing the same thing with echo earlier in the app when the elements are initialized. In the mean time, something destructive is happening to the array. I may be barking up the wrong tree, but it looks to me like an array can't be used inside of a while strucutre unless it's created in it. -- http://www.php.net/manual/en/function.array.php http://master.php.net/manage/user-notes.php?action=edit+30178 http://master.php.net/manage/user-notes.php?action=delete+30178 http://master.php.net/manage/user-notes.php?action=reject+30178

« previous php.notes (#45040) next »