a more efficient way to do this would be to create many to many
relationships betwewen tables that store titles, refs etc.

> -----Original Message-----
> From: Sandis Jerics [mailto:[EMAIL PROTECTED]]
> Sent: 05 July 2001 11:38
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Suggest Table Structure
> 
> 
> Hi!
> 
> It's exactly what i'm doing right now - each article may have
> many pictures, many authors, belong to many categories(sections),
> can be translated in some languages, etc. :)
> Sorry, i havent much time to explain your example, just paste mine
> here.. Perhaps you'll got the idea!
> 
> CREATE TABLE articles (
>   id int(11) NOT NULL auto_increment,
>   title_lv varchar(255) ,
>   title_ru varchar(255) ,
>   title_en varchar(255) ,
>   refs_lv tinytext ,
>   refs_ru tinytext ,
>   refs_en tinytext ,
>   intro_lv text ,
>   intro_ru text ,
>   intro_en text ,
>   cite_lv text ,
>   cite_ru text ,
>   cite_en text ,
>   text_lv longtext ,
>   text_ru longtext ,
>   text_en tinytext ,
>   author_desc_lv text ,
>   author_desc_ru text ,
>   author_desc_en text ,
>   phone tinytext ,
>   fax tinytext ,
>   email tinytext ,
>   web tinytext ,
>   datetime datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ,
>   active int(1) NOT NULL DEFAULT '1' ,
>   counter int(11) NOT NULL DEFAULT '0' ,
>   PRIMARY KEY (id)
> );
> 
> CREATE TABLE articles_images (
>   id int(11) NOT NULL auto_increment,
>   article int(11) NOT NULL DEFAULT '0' ,
>   file varchar(255) NOT NULL DEFAULT '' ,
>   text_lv tinytext ,
>   text_ru tinytext ,
>   text_en tinytext ,
>   url tinytext ,
>   PRIMARY KEY (id),
>   UNIQUE file (file)
> );
> 
> so, the data about images contained in this second table,
> which is linked to the main table "articles" by the article id.
> 
> then i join these tables like this:
> 
> SELECT
>   ...
> FROM
>   articles, articles_images
> WHERE
>   articles_images.article = articles.id
> 
> 
> Hello kachaloo,
> 
> Thursday, July 05, 2001, 12:00:43 PM, you wrote:
> 
> k> Hi guys,
> k>         I am making a table which will store articles for a site
> k>         and the feilds are :
>         
> k>         ID int(6) NOT NULL auto_increment,
> k>         CATEORY varchar(10) NOT NULL DEFAULT 'EVENTS' ,
> k>         HEADING varchar(30) NOT NULL DEFAULT '' ,
> k>         BODY longblob ,
> k>         PICTURE longblob ,
> k>         KEYWORD varchar(30) NOT NULL DEFAULT '' ,
> k>         FILENAME varchar(50) ,
> k>         FILESIZE varchar(50) ,
> k>         FILETYPE varchar(50) ,
> k>         PRIMARY KEY (ID),
> k>         UNIQUE ID (ID)
>         
>         
> k>         But now I noticed some of the articles will have 
> more than one
> k>         picture... so how do I structure my table ?
>         
> k>         Thanks in advance,
> k>         Vishal
> 
> 
> -- 
> PHP Database 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 Database 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]

Reply via email to