I think there is a way to do this, but it is escaping me ..
I have two tables: entries and votes
Users vote on entry, which are stored inside table "votes" like:
id entry_id ip
1 2 129.192.12.4
2 1 129.192.12.4
3 2 129.192.12.4
4 2 129.192.12.4
5 2 129.192.12.4
Inside the "entry" model, how would I grab the number of votes for
each entry?
Aka, I want the data to look like:
array {
[1] =>
[entry] =>
[id] => 1
[text] => 'This is an entry'
[vote] =>
[num_votes] => 1
[2] =>
[entry] =>
[id] => 2
[text] => 'This is entry #2'
[vote] =>
[num_votes] => 4
}
Helps! Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---