Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2009
    Posts
    4

    Event Post Database Design

    Hello Everyone,

    I posted this accidentally in the "MySQL" forum before I saw this one, so sorry about that.

    I am working on a web application that has users log in to their account and create 'events'.

    There is a single table for all users, with a primary key of their email address.

    I can see 2 ways for each user to be able to create accounts:

    1. I could create another table with all posts and an auto_increment key. Then, I could create a relational table that has email address and the key from the events table.

    2. I could create a different table for each user that contains all of their events.

    Which way is more practical/faster? I'm brand new to this stuff. Thanks everyone!

    -Greelmo

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    first thing you need to do is clarify whether you're talking about accounts, users, events, or posts

    those are at least two, possibly three or four tables

    but at no time would you assign a new events table to each user
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2009
    Posts
    4
    Yes, sorry. I realize I didn't type that very clearly.

    I have the accounts table already set up. I'm trying to design the system for each user to be able to post events.

    What is the best way to do this?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    one table for events

    include a user FK column to relate each event to its user

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Jul 2009
    Posts
    4
    How can you set up events tables to delete events that have past from this structure?

    Do you have to do this manually? I'm using PHP and MySQL

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by Greelmo
    Do you have to do this manually?
    as opposed to automatically?

    use a cron job
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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