Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2010
    Posts
    39

    Unanswered: Relating to a new table in mysql

    Hi friends,
    I have just added a 'groups' table to mysql database. I already have a member table that has a group_id field. Should I relate member members of members table to different groups in php or mysql?
    Please it would help a lot if you can give me some example code.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    definitely you should relate the tables with sql, not php

    for example
    Code:
    SELECT members.username
         , groups.groupname
      FROM members
    LEFT OUTER
      JOIN groups
        ON groups.id = members.group_id
    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
  •