Software Development

warning: Creating default object from empty value in /home/campusac/public_html/blog/modules/taxonomy/taxonomy.module on line 1387.

Relational Databases - How to Implement in PHP

When I first started programming for CampusActivism.org I wasn't aware or able to find out how anyone had implemented the "relations" part of a database as a data structure.

So I came up with my own method. Basically I have a giant two dimensional array -- relations[object-1][object-2] which contains information on whether or not a relationship is possible.

(I also created an array that stored whether or not the person who controlled object-1 had persmission to add or delete relations to object-2 -- this was necessary because of my somewhat unique permissions system.)

Now the problem I'm running into is that there are often two relations permissible between two objects -- relationships that I need to treat differently. For instance, I have groups as an object and they can be related to another group because they are 1) a parent group in a network, or 2) a child group in a network.

Syndicate content