Thursday, January 24, 2013

RE: Simple Poll

The poll will have a few questions, each question with a few options / choices to pick from

 

Example Poll

Q1 with choices True or False

Q2 favorite color => choices Red / Black / Blue / none

So on and so on……
Submit Poll

 

Backend admin can create more than one poll at a time so data also needs to include poll_id, user_id, question_id, and choice_id (this data will then get pulled to create a chart)

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of polutan
Sent: Friday, January 25, 2013 1:21 AM
To: cake-php@googlegroups.com
Subject: Re: Simple Poll

 

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 :

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"

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

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: