hmmmm i think i need to fix your models as below :
Poll hasMany Choice
Choice hasMany ChoiceResult or PollResult
That;s just my idea.
Then...you should save your polling result to ChoiceResult model or choice_result table.
choice_result table :
choice_result table :
id
choice_id
other_result
sample data :
id | choice_id | other_result
1 | 1 | NULL
2 | 2 | NULL
3 | 4 | "hmmm i don't know about that"
3 | 4 | "hmmm i don't know about that"
4 | 2 | NULL
#notes: 4 is "Other"
Next... you can find("count") WHERE choice_id = 1,2,3,4
2013/1/25 Advantage+ <movepixels@gmail.com>
--I need to create a simple poll for users and stumped on saving the results when user submits the poll.
Poll hasMany Question
Poll hasMany Result
Question hasMany Choice
Pretty simple, but how do you save the results since viewing the poll creates a form to save Poll?
View the poll/$id pulls all the questions and choices for each, but how / where to save the results?
What would be the correct table for this? poll_results? results?
Thanks,
Dave
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
--
Coklat Stroberi -- Web Dev Training Centre
http://www.facebook.com/pages/Coklat-Stroberi/249514251728226 (info lebih lanjut)
Jl. Raya Padang Luwih (Dalung) No.141 - Telp. (0361) 9006118 atau 08174128301 - Badung, Bali. Sebelah timur traffic light pertigaan perumahan dalung permai.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment