Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to divide input?

    hi
    i'm new to mysql, and would like help with something
    i'm making a script with which u can create your own polls, and the problem is displaying the answers to choose from

    my idea was to enter answers in a textarea dividing them with "enter" (1 in each row) and later, to divide the entry by searching for "/n". the problem is that i don't know how to do that
    help, anyone?
    thx in advance

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    why don't you just create a seperate record for each alternative?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i thought about that...
    wouldn't i need a new table for each question that way?
    this seemed like a better idea
    and i've seen it working on ipb forum
    Last edited by Tomek; 07-29-2006 at 06:09 PM.

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Tomek
    i thought about that...
    wouldn't i need a new table for each question that way?
    no. in a normalised db, you would have a table for the questions, like
    questionID | question_text | createdattime | ...

    and then you would have a table with all your alternatives for all questions. Like
    alternativeID | questionID | alternatie_text | num_votes | createdatime | ...

    Quote Originally Posted by Tomek
    this seemed like a better idea
    and i've seen it working on ipb forum
    well, go ahead and set it up like you see fit. but i've learned that using composit values soner or later gets you into trouble. to be honest: using composit values is almost always a beginners mistake...

    if you don't wanna normalise your db and store all alternatives in one field, then it would also be better to store the alternatives as a serialized array.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by raf
    no. in a normalised db, you would have a table for the questions, like
    questionID | question_text | createdattime | ...

    and then you would have a table with all your alternatives for all questions. Like
    alternativeID | questionID | alternatie_text | num_votes | createdatime |
    jeez that's nice
    thanks a lot


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •