Classifieds System

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

Classifieds System

Post 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
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

Post by wizzard »

anyone?
Stoneguard
Forum Contributor
Posts: 101
Joined: Wed Aug 13, 2003 9:02 pm
Location: USA

Post 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?)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Stoneguard
Forum Contributor
Posts: 101
Joined: Wed Aug 13, 2003 9:02 pm
Location: USA

Post 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.
wizzard
Forum Commoner
Posts: 93
Joined: Thu May 16, 2002 5:36 am
Location: Belgium
Contact:

Post 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
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post 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.
Stoneguard
Forum Contributor
Posts: 101
Joined: Wed Aug 13, 2003 9:02 pm
Location: USA

Post 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 :).
fozturk
Forum Newbie
Posts: 1
Joined: Wed Oct 15, 2003 9:14 am

dear my friend

Post 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
Post Reply