Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
K I'm building a template system for my comany and I want a customer to be able to click on a catagory and have all the templates in that catagory be displayed.
The problem is a template can be in several catagories.
What do you guys think I should to with my DB.
Should I do
catagories table
catagory | templateids
gaming | 2, 25, 42, 13
or should i do
templates table
templateid | catagories
2 | gaming, flash intro
Also anyone have any idea how I would compare the results?
I have a fair grip on this but just wondering if anyone could throw me some useful advice
templateid | catagories
your relationship implies, and even illustrates, a many-to-many relationship. Those are better served by a seperate table for the linkage between them.
so you would want a table that is like:
template_id
category_id
each record holds only 1 id for each side. They aren't unique keys, as then you'd have an asymetric one-to-many system.