Hi,

I am not sure this is what you want or some else...

You can design the table like this so it will be faster to search.
And make the subcategory as linked to category. Means the foreign key.

+--------------------+------------------+------+-----+------------------
---+----------------+
| Field              | Type             | Null | Key | Default
| Extra          |
+--------------------+------------------+------+-----+------------------
---+----------------+
| categoryid         | int(11)          | NO   | PRI | NULL
| auto_increment |
| categoryname       | varchar(50)      | NO   | UNI | NULL
|                |


+-----------------+-------------+------+-----+---------------------+----
------------+
| Field           | Type        | Null | Key | Default             |
Extra          |
+-----------------+-------------+------+-----+---------------------+----
------------+
| subcategoryid   | int(11)     | NO   | PRI | NULL                |
auto_increment |
| categoryid      | int(11)     | NO   | MUL | NULL                |
|
| subcategoryname | varchar(50) | NO   |     | NULL                |
|

Then while search you can make a query with join and search the things
efficiently.

____________
10x, | Ankur Dave | http://ullu.wordpress.com


-----Original Message-----
From: Tamkhane, Pravin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 07, 2006 7:38 PM
To: php-db@lists.php.net
Subject: [PHP-DB] category management using MySQL and PHP

Hi All,
I am working on small web project based on PHP & MySQL where user is
looking for items in certain categories and he specifies the category in
search box, the search result should return all items from that category
& sub-categories of it.

I thought of defining a unique identifier to each category and use them
in search but it may work well only for base categories, for
hierarchical/sub  categories I doubt it will make it simple. Any hints
on how can I solve this? Any pointers would be greatly helpful.

Thanks in advance,
Pravin


The information contained in, or attached to, this e-mail, contains 
confidential information and is intended solely for the use of the individual 
or entity to whom they are addressed and is subject to legal privilege. If you 
have received this e-mail in error you should notify the sender immediately by 
reply e-mail, delete the message from your system and notify your system 
manager. Please do not copy it for any purpose, or disclose its contents to any 
other person. The views or opinions presented in this e-mail are solely those 
of the author and do not necessarily represent those of the company. The 
recipient should check this e-mail and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused, directly or 
indirectly, by any virus transmitted in this email.

www.aztecsoft.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to