itemcd is an element of the array.. like this...
array ('itemcd' => 'book', 'itemdesc' => 'This book is great', 'unitprice'
=> '29.95');
-----Original Message-----
From: Pushkar Pradhan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 11:12 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] beginner in PHP
Is itemcd a variable then it should be used as $itemcd?
> Try this:
>
> echo "$catalog[unitprice]";
>
>
> in my experience I've only been able to use the echo() without the
> quotation marks if I'm calling a function, for variables you need the
> quotation marks.
>
> Hope this helps.
>
>
> Phillip Perry wrote:
>
> >Can someone tell me why this doesn't work?
> >The $mycart array is fine and the $catalog array is also fine but nothing
> >inside the if statement prints. I've tried other echo statements but
nothing
> >prints at all.
> >
> >while (list($key,$value) = each($mycart))
> > {
> > if ($value == $catalog[itemcd])
> > {
> >
> > echo $catalog[unitprice];
> >
> > }
> > }
> >
> >
> >Thanks
> >
> >Phil
> >
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
-Pushkar S. Pradhan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php