Re: Vs: [PHP] More problems...
| From: | Brian Clark | Date: | Sat, 18 Nov 2000 17:22:24 +0000 |
| Subject: | Re: Vs: [PHP] More problems... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26067@lists.php.net to get a copy of this message | ||
(VM == "Ville Mattila") ville.mattila@pilotmedia.net writes:
VM> Hi Brian & others!
VM> This is the code:
VM> ---
VM> while(list($key,$val) = each($prodinfo))
VM> {
VM> print "$key is $val<br>";
VM> }
VM> $availc = $prodinfo["Avail"];
VM> $availdesc = $avail["$availc"];
VM> print "*** $availc = $availdesc";
VM> ---
VM> And this is the output:
VM> ---
VM> ID is 15222
VM> Group is 141
VM> Name is Sabena A319 & A321 & B737
VM> Manuf is
VM> Price is 170
VM> Avail is D
VM> Img is
VM> Desc is
VM> *** D =
VM> ---
Then that looks like the problem, no? (I'm asking because I haven't
seen your whole app.)
Judging by:
> VM> I loaded an array for availability code description like this:
> VM> $avail = array(
> VM> "A1" => "In store",
> VM> "AX" => "Not in store (24 hours)",
> VM> "A" => "Not in store (1-2 days)",
> VM> "B" => "Not in store (1 week)",
> VM> "C" => "Not in store (2 weeks)",
> VM> "D" => "Ei varastossa (3-4 weeks)",
> VM> "X1" => "Not available");
and:
>> VM> $availc = $prodinfo["Avail"];
>> VM> $availdesc = $avail[$availc];
I'd say so.
In order for you to match one of your availability codes, you're going
to have to feed the array a key that it understands.
Ie:
<?php
$avail = array(
"A1" => "In store",
"AX" => "Not in store (24 hours)",
"A" => "Not in store (1-2 days)",
"B" => "Not in store (1 week)",
"C" => "Not in store (2 weeks)",
"D" => "Ei varastossa (3-4 weeks)",
"X1" => "Not available");
$prodinfo['Avail'] = 'A1';
$availdesc = $avail[$prodinfo['Avail']];
print $availdesc;
?>
-Brian