SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2010
    0 Post(s)
    0 Thread(s)

    Lookup Table question


    I'm in the middle of the Sitepoint book "Build your own database driven web site using PHP & MySQL" and on page 168 it says "Now that your lookup table is in place and contains category assignments, you can use joins…".

    Am I correct in assuming that this lookup table (titled "jokecategory" in the book) was populated with the category assignments manually? - That each value was assigned to it's field through an INSERT INTO command?

    Or am I missing something and there was some way that the lookup table was automatically populated with the data from the other two tables ("joke" and "category" in the book)?

    Thanks very much!


  2. #2
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    from Madrid to Heaven
    247 Post(s)
    1 Thread(s)
    Your assumption is quite logical.

    I don't have the book itself in front of me right now but if it is a lookup table, either you fill it using INSERT INTO commands, or you import the data from a CSV file or other type of text file. Either way, at some point, you had to insert the data manually.

    Other solution could be to extract these values from some other table using a SELECT query with a DISTINCT attribute so you will not get repeated values in the result. That is, of course, if the values where already in other table


Posting Permissions

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