category management using MySQL and PHP
am 07.11.2006 15:07:30 von ptamkhane
------=_NextPart_000_004A_01C702A4.2A0C9BF0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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.=20
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
------=_NextPart_000_004A_01C702A4.2A0C9BF0--
RE: category management using MySQL and PHP
am 07.11.2006 15:26:16 von Ankur Dave
Hi,=0D
I am not sure this is what you want or some else...=0D
You can design the table like this so it will be faster to search.=0D
And make the subcategory as linked to category. Means the foreign key.=0D
+--------------------+------------------+------+-----+------ ------------
---+----------------+
| 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.=0D
____________
10x, | Ankur Dave | http://ullu.wordpress.com
=0D
-----Original Message-----
From: Tamkhane, Pravin [mailto:ptamkhane@gmail.com]=0D
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.=0D
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