SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2013
    United Kingdom
    0 Post(s)
    0 Thread(s)

    Structuring a database for membership details

    This is my first post on these forums. I have been reading Sitepoint's 'PHP & MySQL Novice to Ninja' by Kevin Yank (5th Ed, May 2012) and now I am trying to put it into practice. I want to build a website for displaying news photographs to a restricted audience of media professionals, who will hopefully go on to pay me for publishing my pictures. Initially I am trying to create a registration page that will collect information from my visitors (first name, last name, job title, organisation, country, landline, cellphone, email address, hashed password), and then a login page for members who have registered. Members will obviously need to be able to edit their entries if details subsequently change.

    I have studied Kevin Yank's example of the joke database that he creates in the book, but it doesn't seem directly transferable to the kind of database I need to build, unless I am simply not understanding it correctly.

    In terms of structuring the database and best practice, should I have 9 separate tables for each element of information that I am collecting and link for each individual using look-up tables, as Kevin does for his joke database? Alternatively would it be better to have just one table with 9 columns for each member?

    Many thanks in anticipation of any answers to that question, and general advice about the way I'm starting out or experiences of Kevin's manual.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Toronto, Canada
    63 Post(s)
    3 Thread(s)
    no, in this case you need only one table, for your registered visitors

    store the data in appropriate columns like VARCHARs

    there should be no need for "lookup" tables, unless there is some element of data which has a limited set of valid values that you want to control

    the closest example would be country code, but even here, i would not use a lookup table -- just let them enter whatever they want | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Posting Permissions

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