Hi, you have to break your table in pieces and create tables for items that occur more
than once. For example:
CREATE TABLE articles (
ID int(6) NOT NULL auto_increment,
id_category UNSIGNED INT REFERENCES category,
HEADING varchar(30) NOT NULL DEFAULT '' ,
BODY longblob ,
...)
CREATE TABLE pictures (
ID int(6) NOT NULL auto_increment,
PICTURE longblob ,
id_article UNSIGNED INT REFERENCES articles)
CREATE TABLE category (
ID int(6) NOT NULL auto_increment,
category varchar(30))
So, if you want to list all the pictures of the article 'Linux Rules!' you have to
write a query like:
SELECT heading, picture FROM articles, pictures WHERE pictures.id_article =
articles.id AND heading='Linux Rules!'
PS: A create the table category to illustrate how to put things in order with some
normal forms.
On Thu, Jul 05, 2001 at 02:31:55PM +0530, kachaloo wrote:
> Hi guys,
> I am making a table which will store articles for a site
> and the feilds are :
>
> ID int(6) NOT NULL auto_increment,
> CATEORY varchar(10) NOT NULL DEFAULT 'EVENTS' ,
> HEADING varchar(30) NOT NULL DEFAULT '' ,
> BODY longblob ,
> PICTURE longblob ,
> KEYWORD varchar(30) NOT NULL DEFAULT '' ,
> FILENAME varchar(50) ,
> FILESIZE varchar(50) ,
> FILETYPE varchar(50) ,
> PRIMARY KEY (ID),
> UNIQUE ID (ID)
>
>
> But now I noticed some of the articles will have more than one
> picture... so how do I structure my talbe ?
>
> Thanks in advance,
> Vishal
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]