attache more categories to one post
Posted: Wed Jul 25, 2007 6:31 pm
I have table movies, which contains (title, movie_categories)
could someone give me example HOW should I construct mysql that I be able to attache multy categories to one entery.
now here is how does it look for now
But I'm totaly lost, pleas give me example of mysql structure and how to use.
If possible (if know any) tutorial would be great.
I searched internet all night but havent found nothing exatly that I need.
(maybe I was searching for wrong stuff)
could someone give me example HOW should I construct mysql that I be able to attache multy categories to one entery.
now here is how does it look for now
Code: Select all
CREATE TABLE `movies` (
`movieID` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`categories` varchar(255) default NULL,
UNIQUE KEY `catid` (`movieID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;Code: Select all
CREATE TABLE `categories` (
`cat_id` int(11) NOT NULL default '0',
`category_name` varchar(255) NOT NULL default '0',
PRIMARY KEY (`cat_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Code: Select all
CREATE TABLE `categories_relations` (
`movie_id` int(11) NOT NULL default '0',
`category_id` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;If possible (if know any) tutorial would be great.
I searched internet all night but havent found nothing exatly that I need.
(maybe I was searching for wrong stuff)