Page 1 of 1

Classifieds System

Posted: Tue Oct 14, 2003 10:10 am
by wizzard
Hello,

I'm working on a Classifieds but i don't know how this work like i have this main cats with subcats=

Computer => Hardware, Software
People => Jobs, Services
Synths => Samplers, Vintages

How can i fix something like this with cats, subcats and how to fix this in the database like tables i need.

I need on my mainpage something like this => http://www.macmusic.org/ads/?lang=EN

Cheers
Kris

Posted: Tue Oct 14, 2003 12:25 pm
by wizzard
anyone?

Posted: Tue Oct 14, 2003 12:42 pm
by Stoneguard
Well Mr Rincewind (sorry, your user name reminds me of a book),

I would think you must think about how to designate a record as a category or a sub-category, and what it's parent category is. Then you would write a routine to pull categories and add their children records under them.

That should get you started. My understanding for this site is the intent is for you to present a solution that you need help with, not ask for a solution (isn't that what we get paid for? providing solutions?)

Posted: Tue Oct 14, 2003 3:48 pm
by twigletmac
OT:
Stoneguard wrote:Well Mr Rincewind (sorry, your user name reminds me of a book),
Reminds me I need to buy Monstrous Regiment...

Mac

Posted: Tue Oct 14, 2003 4:17 pm
by Stoneguard
I bought it in Hardback. I just wish the books came out here int he states on the same schedule as they do in England.

Posted: Wed Oct 15, 2003 4:10 am
by wizzard
Stoneguard sorry that i was asking for a complete solution but i need only help with this how i can put on my mainpage the category's and subcategorys

Like

Computers(40)
Hardware(30)
Software(10)

I know i need a table with the main category's and a table with subcats.

Cheers
Kris

Posted: Wed Oct 15, 2003 6:12 am
by DuFF
For specific categories and subcategories in a database I usually use 2 ENUM columns. One for all possible categories and one for all possible subcategories.

As far as I can see you'd want an ENUM column named Category with: Computer, People, Synths as the choices. Then have Hardware, Software, Jobs, Services, Samplers, Vintages as another ENUM column named Subcategory.

Posted: Wed Oct 15, 2003 7:51 am
by Stoneguard
I was just expressing how the owners of the site wish for it to work, under my own understanding. I could be totally wrong, too, since I am new here :).

dear my friend

Posted: Wed Oct 15, 2003 9:14 am
by fozturk
as my friend says you can use enum type to indicate that that column is showing whether that index is a categiry or subcategory
you will searc the upper catgorys as
select * from my_table where enum_column=1;
this will return the column indexes where they are marked as 1
then u can start to search the sub categories
and also you can give indexes to upper categories in an other int column so u can organize the sub ones as this
select * from my_table where uppercategor_enum_column = 3;
for ex 3 indicates computers
i wish i could help to you