Hi! Thanks for your help again rehfeld!
for loop {
$array[$itemid] = $size;
}
This works but here is the problem I am facing now...
Please consider the following scenario:
I am trying to sell a "PC Monitor"... and this comes in 3 different sizes
The entry for this in my database is like:
ItemID: 10
ItemName: Samsung PC Monitor
Size1: Small 15"
Size2: Medium 17"
Size3: Large 21"
Now a user on my website is allowed to choose any OR all of the three sizes using the chekboxes. Say he checked ALL the three sizes and clicked on the button saying -- View Details. Now on the view details page I am using the following code to get the deatils for each size of the product:
Code: Select all
for loop {
$arrayї$itemid] = $size;
}
foreach ($array as $key => $val) {
$query = "SELECT * FROM details WHERE ItemID = '$key' && Size = '$val'";
}
and what I am expecting the array to be like is:
$array = array('10 => Small 15" ', '10 => Medium 17" ', '10 => Large 21" ');
But the array seems to be only like:
$array = array('10 => Large 21"');
and when I say
Code: Select all
foreach ($array as $key => $val) {
echo "Key: $key --- Val: $val"
}
It's only showing:
Key: 10 --- Val: Large 21"
Why so like that???
It's working fine with two different products but not with two different sizes. If i choose all the 3 sizes for two products, say "Samsung PC Monitor" and "Acer PC Monitor" then only the 3rd size of both the products is showing up and not all the sizes.
In this case the $array is coming up like:
$array = array('10 = > Large 21" ', '11 = > Large 21" ');
where 11 is the id for "Acer PC Monitor"
Can I get some help with this??
I don't know how clear I am in explaining my problem but if you have any questions please feel free to ask me.
Thanks soooo much!
Mairaj.