[Fwd: Re: Undefined Index ...confusion]

[Fwd: Re: Undefined Index ...confusion]

am 23.07.2009 16:52:17 von kyle.smith

--------------010804020207040209030209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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
($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:



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

--------------010804020207040209030209--

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

am 23.07.2009 22:21:59 von tmiller

Thanks


On 7/23/09 9:52 AM, "Kyle Smith" 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 =3D 1;
2.

3.
while ($row =3D mysql_fetch_array
_array>($result))
4.
{
5.
$_SESSION['fullRestaurantList'][$position] =3D $row;
6.
$position++;
7.
}
8.

9.
$_SESSION['totalNumberOfRestaurants'] =3D $position;

So, if you get 7 rows. Your array will have:

Array =3D> (Row 1 Data)
Array =3D> (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:



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