SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Not Bad, eh? Justin Sampson's Avatar
    Join Date
    Aug 2000
    Location
    N.S., Canada
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I'm kind of new to MYSQL/PHP but I love it!

    I'm making my site database driven. I have a table that has a design like the fallowing:

    ID | body | author | title | email | about

    I am trying to implyment it so users can add comments and I was thinking of designing that table like this:

    email | name | comment | id | vis

    and with content might look like this:

    email | name | comment | id | vis
    BoB@ Bob cool 1 Y
    joe@ Joe sucks 2 Y
    sue@ Sue neat 1 N

    ID in the second table would be the ID of the article the comment is for. Vis would be defaultly set to N for not visible and Y when I aprove it. Then I could call all the comments for a pacific article by using where id=2 and all the coments would be in one table. Do you think that would be a viable way of doing it?

    Also, does a table always have to have and auto_incrementing column?

    Thanks,
    Justin Sampson

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it does not have to have a auto_increment field, I would suggest that you add one to the comments table so if you ever need to grab just one comment from the comments table you coul get it from the id here is how I would set the tables up:
    Articles
    ID | body | author | title | email | about

    Comments
    ID | email | name | comment | art_id | vis
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    Not Bad, eh? Justin Sampson's Avatar
    Join Date
    Aug 2000
    Location
    N.S., Canada
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, thanks Freddydoesphp! I see why it would be better to have an auto_incrementing column

    Thanks,
    Justin Sampson


Bookmarks

Posting Permissions

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