Re: looking for webpage with database "tricks"

From: Date: Mon, 28 Aug 2000 02:22:23 +0000
Subject: Re: looking for webpage with database "tricks"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13886@lists.php.net to get a copy of this message
On 25 Aug, Chris Hayes wrote: > > Is there a tutorial on the web explaining how you can do nice stuff with > relational databases? > > Like how webmonkey tries to explain how messages are sorted with a forum. > > My real question is: > * I have a user table > * I have an agenda table with messages > > Now they want me to make agenda categories and users must be able to get a > list only of agenda items of the categories they are interested in AND: > the categories must be as flexible as can be. One should be able to _add_ a > category. I thought of making an extra category table with rows for every > category with it's place in order, _and_ put all chosen categories in one > field in the users table like > cat1*cat3*catn > And when making their personal message I will do some great juggling trick > with that string. > But probably there is a better way. > > that's why i asked for tutorials... > > cheers. > Chris If you find one, let me know :-) But a possible solution to your dilemma might be to add a third table that simply provides a link between user and categories: User table Link Categories userid [k] linkid [k] catid [k] other catid category userid where the fields with k are unique keys. Then you can have any number of link entries for any user. And you can readily maintain the category table independent of the user table. Of course you'd need to check that there aren't any related entries in the link table before deleting a category (or user, for that matter) Cheers -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#13886) next »