You are here: Re: assign items to more than one category « All PHP « IT news, forums, messages
Re: assign items to more than one category

Posted by ZeldorBlat on 12/09/06 21:28

Dave Nash wrote:
> Thanks Aho
>
> So how do I get the data from a db.
> I have retrieved the category listings with this
>
> "SELECT * FROM categories" which gives me a page with the categories
> and links to a a page called listitems.php
>
> What I cant work out is how to view all of the items once i click on a
> category that match the category id in the relational table.
>
> thanks again.
>
>
>
>
> On Sat, 09 Dec 2006 13:55:44 +0100, "J.O. Aho" <user@example.net>
> wrote:
>
> >Dave Nash wrote:
> >> hi All,
> >>
> >> I have created a database with two tables, categories and items.
> >>
> >> How do I go about assigning a particular item to more than one
> >> category?
> >>
> >>
> >> <Categories table>
> >> Catid
> >> Catname
> >>
> >> <Items table>
> >> Itemid
> >> itemname
> >
> >Create a relation table
> >
> ><ItemCat table>
> >Itemid
> >Catid
> >
> >
> > //Aho

Get all the items that belong to catid 5:

select i.itemid, i.itemname
from item i
join ItemCat ic
on i.itemid = ic.itemid
where ic.catid = 5

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация