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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts

    One comment box multiple inputs

    Hi All,

    In my next learning phase I though that I want to learn on comment box...

    below is the senario:

    I have one comment box but multiple people comment on the thread using this comment box but what is the logic I can store all this comments with 1 or 2 columns.

    Most of the social networking sites & ticketing system has this feature.


    summary: One comment input box and 1 column to input data in php.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,611
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Store each comment as a row in a table in a database.

    Retrieve the rows and organise them as required for display.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by felgall View Post
    Store each comment as a row in a table in a database.

    Retrieve the rows and organise them as required for display.
    With your comments I am visualising some plans and willing to see some examples ....of mysql structure.

    I have search in Google but could not find any relevant information in case if you can share with me some example that will be great help for my analysis....

    Regards,
    Nani

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Simple example:
    Code:
    +------------------+         +------------------------+
    | article          |         | articlecomment         |
    +------------------+         +------------------------+
    | articleid [PK]   |>+-----o<| articleid [PK][FK]     |
    | title            |         | userid [PK][FK]        |
    | written          |         | written                |
    | content          |         | content                |
    +------------------+         +------------------------+
    That assumes you have user's commenting and not guests. Although even with guests, if you have a system that provides both users and anonymous guests, than you should probably have a guest account in which to link the userid to as well.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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