OK, so basically you have an array on top of everything. That's why you
can't debug($data['Product']); or loop it directly.
For this particular $data, to iterate through each product, you will need to
use:
Foreach ($data as $holiday) {
Foreach ($holiday['Prodcut'] as $product) {
[Write your code here]
}
}
If this still doesn't work, it's either you omitted something else important
on your e-mail, or something really-really bad have happened. If this
doesn't help, please provide us with the $this->set(); statement from the
controller.
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of leamas
Sent: 21 Desember 2006 7:06
To: Cake PHP
Subject: Re: Joining 2 tables - better practice?
I had remove ['Product'] from $data['Product'] otherwise it would cause
an error if I debug($data).
The output for $data is:
Array
(
[0] => Array
(
[Holiday] => Array
(
[id] => 1
[holiday_name] => Halloween
)
[Product] => Array
(
[0] => Array
(
[id] => 668
[product_name] => //cut out
[description] => //cut out
[price] => 1.29
[URL] => //cut out
[image] => //cut out
[category_id] => 12
[holiday_id] => 1
[added] => 2006-04-29
[newProd] => 0
[stock] => 1
[hits] => 3
)
[1] => Array
(
[id] => 1089
[product_name] => //cut out
[description] => //cut out
[price] => 0.60
[URL] => //cut out
[image] => //cut out
[category_id] => 9
[holiday_id] => 1
[added] => 2006-05-26
[newProd] => 0
[stock] => 1
[hits] => 0
)
[2] => Array
(
[id] => 1090
[product_name] => //cut out
[description] => //cut out
[price] => 0.60
[URL] => //cut out
[image] => //cut out
[category_id] => 9
[holiday_id] => 1
[added] => 2006-05-26
[newProd] => 0
[stock] => 1
[hits] => 0
)
...
The way that this should work out is that $data would hold only
products that are under the certain holiday, which itl ooks like it is
doing from the output.
So in the view, it will use a foreach loop and display each product
from $data.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---