Here is a nice simple "MVC PHP Framework", which is powerful, lightweight, very
flexible, transparent. One can easily modify as per their need. It is not
complex or very restricted like other frameworks. Just have a look at this http://www.celeroo.com/frame/frame.html
I have categories table with multilevel categories I need to
make the insert statement for the sub categories and sub subcategories so I need
to populate a <select> box with this tree so I can insert the parent id
with the new subcategory
Anyone knows how to populate this select box with the tree ??
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select. Once the user select any of the element in Top <select you have to pass it's id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in <select. Same procedure is follow for next level of category. You can go till n level with this approach.
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU.
To: phpresource@yahoogroups.com From: badr@... Date: Sun, 7 Jun 2009 15:45:27 +0300 Subject: [phpResource] multilevel categories
I have categories table with multilevel categories I need to
make the insert statement for the sub categories and sub subcategories so I need
to populate a <select> box with this tree so I can insert the parent id
with the new subcategory
Anyone knows how to populate this select box with the tree ??
In Oracle, you can get the parent child tree in one query, but that technique is not yet supported in mysql. So you will have to do the same as suggested by Rizwan.
From: Muhammad Rizwan Nawaz <rizwan_nawaz786@...> To: phpresource@yahoogroups.com Sent: Monday, June 8, 2009 6:35:43 AM Subject: RE: [phpResource] multilevel categories
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select. Once the user select any of the element in Top <select you have to pass it's id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in <select. Same procedure is follow for next level of category. You can go till n level with this approach.
============ = SECURITY NOTICE
============ =
   Â
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL.  IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE.  IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
   Â
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU.
To: phpresource@ yahoogroups. com From: badr@mohamedbadr. com Date: Sun, 7 Jun 2009 15:45:27 +0300 Subject: [phpResource] multilevel categories
I have categories table with multilevel categories I need to
make the insert statement for the sub categories and sub subcategories so I need
to populate a <select> box with this tree so I can insert the parent id
with the new subcategory
Anyone knows how to populate this select box with the tree ??
From:
phpresource@yahoogroups.com [mailto:phpresource@yahoogroups.com] On Behalf
Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 6:36 AM To: phpresource@yahoogroups.com Subject: RE: [phpResource] multilevel categories
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select.
Once the user select any of the element in Top <select you have to pass it's
id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in
<select. Same procedure is follow for next level of category. You can go
till n level with this approach.
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND
CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY
NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED
RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY
OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE
IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT.
THANK YOU.
To: phpresource@yahoogroups.com
From: badr@...
Date: Sun, 7 Jun 2009 15:45:27 +0300
Subject: [phpResource] multilevel categories
I have
categories table with multilevel categories I need to make the insert statement
for the sub categories and sub subcategories so I need to populate a
<select> box with this tree so I can insert the parent id with the new
subcategory
Anyone knows
how to populate this select box with the tree ??
In this case, you will have to check if the current ID has been used as parent or no. If yes, run the query to find its child. Most probably, you will be writing a recursive function to achieve this.
From:
phpresource@ yahoogroups. com [mailto:phpresource @yahoogroups. com] On Behalf
Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 6:36 AM To: phpresource@ yahoogroups. com Subject: RE: [phpResource] multilevel categories
Â
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select.
Once the user select any of the element in Top <select you have to pass it's
id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in
<select. Same procedure is follow for next level of category. You can go
till n level with this approach.
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND
CONFIDENTIAL.  IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY
NAMED ABOVE.  IF THE READER OF THIS MESSAGE IS NOT THE INTENDED
RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY
OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
   Â
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE
IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT.
THANK YOU.
To: phpresource@ yahoogroups. com
From: badr@mohamedbadr. com
Date: Sun, 7 Jun 2009 15:45:27 +0300
Subject: [phpResource] multilevel categories
I have
categories table with multilevel categories I need to make the insert statement
for the sub categories and sub subcategories so I need to populate a
<select> box with this tree so I can insert the parent id with the new
subcategory
Anyone knows
how to populate this select box with the tree ??
From:
phpresource@yahoogroups.com [mailto:phpresource@yahoogroups.com] On Behalf
Of Atif Majid Sent: Monday, June 08, 2009 11:09 AM To: phpresource@yahoogroups.com Subject: Re: [phpResource] multilevelscategories
In
this case, you will have to check if the current ID has been used as parent or
no. If yes, run the query to find its child. Most probably, you will be writing
a recursive function to achieve this.
From:
phpresource@ yahoogroups. com [mailto:phpresource @yahoogroups. com] On
Behalf Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 6:36 AM To: phpresource@ yahoogroups. com Subject: RE: [phpResource] multilevel categories
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select.
Once the user select any of the element in Top <select you have to pass it's
id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in
<select. Same procedure is follow for next level of category. You can go
till n level with this approach.
THE INFORMATION CONTAINED IN THIS
TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS INTENDED FOR THE
USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE READER OF THIS
MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY
DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY
PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN
ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER
AND DELETE IT. THANK YOU.
To:
phpresource@ yahoogroups. com
From: badr@mohamedbadr. com
Date: Sun, 7 Jun 2009 15:45:27 +0300
Subject: [phpResource] multilevel categories
I have
categories table with multilevel categories I need to make the insert statement
for the sub categories and sub subcategories so I need to populate a
<select> box with this tree so I can insert the parent id with the new
subcategory
Anyone knows
how to populate this select box with the tree ??
From:
phpresource@ yahoogroups. com [mailto:phpresource @yahoogroups. com] On Behalf
Of Atif Majid Sent: Monday, June 08, 2009 11:09 AM To: phpresource@ yahoogroups. com Subject: Re: [phpResource] multilevelscategori es
Â
In
this case, you will have to check if the current ID has been used as parent or
no. If yes, run the query to find its child. Most probably, you will be writing
a recursive function to achieve this.
From: Mohamed BADR <badr@mohamedbadr. com> To: phpresource@ yahoogroups. com Sent: Monday, June 8, 2009 10:53:09 AM Subject: RE: [phpResource] multilevelscategori es
But that means for each level I have to
do a select query, and I don’t know how many levels are there, it should be
unlimited so how do I do that ??
From:
phpresource@ yahoogroups. com [mailto:phpresource @yahoogroups. com] On
Behalf Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 6:36 AM To: phpresource@ yahoogroups. com Subject: RE: [phpResource] multilevel categories
Â
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select.
Once the user select any of the element in Top <select you have to pass it's
id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in
<select. Same procedure is follow for next level of category. You can go
till n level with this approach.
THE INFORMATION CONTAINED IN THIS
TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL.  IT IS INTENDED FOR THE
USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE.  IF THE READER OF THIS
MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY
DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY
PROHIBITED.
   Â
IF YOU HAVE RECEIVED THIS COMMUNICATION IN
ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER
AND DELETE IT. THANK YOU.
To:
phpresource@ yahoogroups. com
From: badr@mohamedbadr. com
Date: Sun, 7 Jun 2009 15:45:27 +0300
Subject: [phpResource] multilevel categories
Â
I have
categories table with multilevel categories I need to make the insert statement
for the sub categories and sub subcategories so I need to populate a
<select> box with this tree so I can insert the parent id with the new
subcategory
Anyone knows
how to populate this select box with the tree ??
Either you can used the recursive function as suggested by Atif or you can use AJAX to reach at certain level. AJAX will be more efficient technique as in this way you are just loading required data.
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU.
To: phpresource@yahoogroups.com From: atif_majid10@... Date: Mon, 8 Jun 2009 01:08:48 -0700 Subject: Re: [phpResource] multilevelscategories
In this case, you will have to check if the current ID has been used as parent or no. If yes, run the query to find its child. Most probably, you will be writing a recursive function to achieve this.
From:
phpresource@ yahoogroups. com [mailto:phpresource @yahoogroups. com] On Behalf
Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 6:36 AM To: phpresource@ yahoogroups. com Subject: RE: [phpResource] multilevel categories
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select.
Once the user select any of the element in Top <select you have to pass it's
id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in
<select. Same procedure is follow for next level of category. You can go
till n level with this approach.
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND
CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY
NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED
RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY
OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE
IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT.
THANK YOU.
To: phpresource@ yahoogroups. com
From: badr@mohamedbadr. com
Date: Sun, 7 Jun 2009 15:45:27 +0300
Subject: [phpResource] multilevel categories
I have
categories table with multilevel categories I need to make the insert statement
for the sub categories and sub subcategories so I need to populate a
<select> box with this tree so I can insert the parent id with the new
subcategory
Anyone knows
how to populate this select box with the tree ??
From: phpresource@yahoogroups.com
[mailto:phpresource@yahoogroups.com] On Behalf Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 11:43 AM To: phpresource@yahoogroups.com Subject: RE: [phpResource] multilevelscategories
Either you can used the recursive function as suggested by Atif or you can use
AJAX to reach at certain level. AJAX will be more efficient technique as in
this way you are just loading required data.
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND
CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY
NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED
RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY
OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE
IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT.
THANK YOU.
To: phpresource@yahoogroups.com
From: atif_majid10@...
Date: Mon, 8 Jun 2009 01:08:48 -0700
Subject: Re: [phpResource] multilevelscategories
In
this case, you will have to check if the current ID has been used as parent or
no. If yes, run the query to find its child. Most probably, you will be writing
a recursive function to achieve this.
From: phpresource@ yahoogroups. com [mailto:phpresource
@yahoogroups. com] On Behalf Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 6:36 AM To: phpresource@ yahoogroups. com Subject: RE: [phpResource] multilevel categories
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select.
Once the user select any of the element in Top <select you have to pass it's
id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in
<select. Same procedure is follow for next level of category. You can go
till n level with this approach.
THE INFORMATION
CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS
INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE
READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED
THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY
PROHIBITED.
IF YOU HAVE
RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE
ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU.
To: phpresource@ yahoogroups. com
From: badr@mohamedbadr. com
Date: Sun, 7 Jun 2009 15:45:27 +0300
Subject: [phpResource] multilevel categories
I have
categories table with multilevel categories I need to make the insert statement
for the sub categories and sub subcategories so I need to populate a
<select> box with this tree so I can insert the parent id with the new
subcategory
Anyone
knows how to populate this select box with the tree ??
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU.
To: phpresource@yahoogroups.com From: badr@... Date: Mon, 8 Jun 2009 12:21:06 +0300 Subject: RE: [phpResource] multilevelscategories
I need all cats, subcats to be in one select box, how do I do
that ?
From: phpresource@yahoogroups.com
[mailto:phpresource@yahoogroups.com] On Behalf Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 11:43 AM To: phpresource@yahoogroups.com Subject: RE: [phpResource] multilevelscategories
Either you can used the recursive function as suggested by Atif or you can use
AJAX to reach at certain level. AJAX will be more efficient technique as in
this way you are just loading required data.
THE INFORMATION CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND
CONFIDENTIAL. IT IS INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY
NAMED ABOVE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED
RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION OR COPY
OF THIS COMMUNICATION IS STRICTLY PROHIBITED.
IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE
IMMEDIATELY NOTIFY AND RETURN THE ORIGINAL MESSAGE TO THE SENDER AND DELETE IT.
THANK YOU.
To: phpresource@yahoogroups.com
From: atif_majid10@yahoo.com
Date: Mon, 8 Jun 2009 01:08:48 -0700
Subject: Re: [phpResource] multilevelscategories
In
this case, you will have to check if the current ID has been used as parent or
no. If yes, run the query to find its child. Most probably, you will be writing
a recursive function to achieve this.
From: phpresource@ yahoogroups. com [mailto:phpresource
@yahoogroups. com] On Behalf Of Muhammad Rizwan Nawaz Sent: Monday, June 08, 2009 6:36 AM To: phpresource@ yahoogroups. com Subject: RE: [phpResource] multilevel categories
Hi,
Top most element don't have parent so it's partent_id is 0. Your first query is
Select * from hosp_categories where parent_id = '0'
This will give you the top elements which you can loop and shows in <select.
Once the user select any of the element in Top <select you have to pass it's
id in query string and run the following query to load the child,
select * from hosp_categories where parent_id = '$ID FROM QUERY STRING'
This will give you the list of child of selected which you can easily show in
<select. Same procedure is follow for next level of category. You can go
till n level with this approach.
THE INFORMATION
CONTAINED IN THIS TRANSMISSION IS PRIVILEGED AND CONFIDENTIAL. IT IS
INTENDED FOR THE USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. IF THE
READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED
THAT ANY DISSEMINATION, DISTRIBUTION OR COPY OF THIS COMMUNICATION IS STRICTLY
PROHIBITED.
IF YOU HAVE
RECEIVED THIS COMMUNICATION IN ERROR, PLEASE IMMEDIATELY NOTIFY AND RETURN THE
ORIGINAL MESSAGE TO THE SENDER AND DELETE IT. THANK YOU.
To: phpresource@ yahoogroups. com
From: badr@mohamedbadr. com
Date: Sun, 7 Jun 2009 15:45:27 +0300
Subject: [phpResource] multilevel categories
I have
categories table with multilevel categories I need to make the insert statement
for the sub categories and sub subcategories so I need to populate a
<select> box with this tree so I can insert the parent id with the new
subcategory
Anyone
knows how to populate this select box with the tree ??