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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks


On 7/23/09 9:52 AM, "Kyle Smith" <kyle.smith@xxxxxxxxxxxxxx> 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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux