Re: [Fwd: Re: [PHP] Undefined Index ...confusion] (RESOLVED)

From: Date: Thu, 23 Jul 2009 20:21:59 +0000
Subject: Re: [Fwd: Re: [PHP] Undefined Index ...confusion] (RESOLVED)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-295775@lists.php.net to get a copy of this message
Thanks On 7/23/09 9:52 AM, "Kyle Smith" <kyle.smith@inforonics.com> wrote: Sorry, list, I did a reply instead of a reply-to-all. This is what I sent to "Miller, Terion" Miller, Terion wrote: > Thanks for the link Kyle!! Great thing there...(seriously I didn't know....I learn > something everyday) > > Anyways the link to my script is: http://pastebin.ca/1504393 > Your email client is annoying, it doesn't quote. Haha. Anyway, so, you're loading up that array with arrays of arrays, here: 1. $position = 1; 2. 3. while ($row = mysql_fetch_array <http://www.php.net/mysql_fetch_array><http://www.php.net/mysql_fetch_array>($result)) 4. { 5. $_SESSION['fullRestaurantList'][$position] = $row; 6. $position++; 7. } 8. 9. $_SESSION['totalNumberOfRestaurants'] = $position; So, if you get 7 rows. Your array will have: Array => (Row 1 Data) Array => (Row 2 Data) .. etc You do not have ['fullRestaurantList']['ID']. In the page you're referencing you use something like $_SESSION['fullRestaurantList'][$i]['SomeValue']. I assume $i is the "Position" in the array, so you likely want to use $_SESSION['fullRestaurantList'][$i]['ID'] to get the ID field from that row.. If you need a quick dump to better understand what data you have in your session, try making a page called session_dump.php in the same directory with this source: <pre><? print_r($_SESSION) ?></pre> That will give you a good idea of what your session array looks like, and you should see clearly that ['fullRestaurantList']['ID'] does not exist.. Hope this helps! - Kyle

« previous php.general (#295775) next »