Search the web
Sign In
New User? Sign Up
phpresource · Storehouse of PHP Resources
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
PHP MVC Framework   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#2721 From: "celeroos" <celeroos@...>
Date: Thu Apr 23, 2009 9:58 am
Subject: PHP MVC Framework
celeroos
Offline Offline
Send Email Send Email
 
Hi,

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

Thanks
celeroo
Web Software Development Tool




#2724 From: "Mohamed BADR" <badr@...>
Date: Sun Jun 7, 2009 12:45 pm
Subject: multilevel categories
badrm1000000
Offline Offline
Send Email Send Email
 

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 table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

 

 


#2725 From: Muhammad Rizwan Nawaz <rizwan_nawaz786@...>
Date: Mon Jun 8, 2009 3:35 am
Subject: RE: [phpResource] multilevel categories
rizwan051
Offline Offline
Send Email Send Email
 
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.



Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger: rizwan_nawaz786@...
Gmail: rizwannawaz@... 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681 

=============

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@...
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 table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

 

 




Lauren found her dream laptop. Find the PC that’s right for you.

#2726 From: Atif Majid <atif_majid10@...>
Date: Mon Jun 8, 2009 6:38 am
Subject: Re: [phpResource] multilevel categories
atif_majid10
Offline Offline
Send Email Send Email
 
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.
 
Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele.com



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.



Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger: rizwan_nawaz786@ hotmail.com
Gmail: rizwannawaz@ gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681 

============ =

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 ??

 

The table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id` )

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT= 7 ;

 

 




Lauren found her dream laptop. Find the PC that’s right for you.


#2727 From: "Mohamed BADR" <badr@...>
Date: Mon Jun 8, 2009 7:53 am
Subject: RE: [phpResource] multilevelscategories
badrm1000000
Offline Offline
Send Email Send Email
 

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 ??

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedbadr.com/

 

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.


Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@...
Gmail:
rizwannawaz@... 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

=============

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@...
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 table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

 

 

 

 


Lauren found her dream laptop. Find the PC that’s right for you.


#2728 From: Atif Majid <atif_majid10@...>
Date: Mon Jun 8, 2009 8:08 am
Subject: Re: [phpResource] multilevelscategories
atif_majid10
Offline Offline
Send Email Send Email
 
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.
 
Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele.com



From: Mohamed BADR <badr@...>
To: phpresource@yahoogroups.com
Sent: Monday, June 8, 2009 10:53:09 AM
Subject: RE: [phpResource] multilevelscategories

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 ??

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedb adr.com/

 

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.


Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@ hotmail.com
Gmail:
rizwannawaz@ gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

============ =

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 ??

 

The table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id` )

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT= 7 ;

 

 

 

 


Lauren found her dream laptop. Find the PC that’s right for you.



#2729 From: "Mohamed BADR" <badr@...>
Date: Mon Jun 8, 2009 8:15 am
Subject: RE: [phpResource] multilevelscategories
badrm1000000
Offline Offline
Send Email Send Email
 

I need a code example to do that

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedbadr.com/

 

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.

 

Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele.com

 

 


From: Mohamed BADR <badr@...>
To: phpresource@yahoogroups.com
Sent: Monday, June 8, 2009 10:53:09 AM
Subject: RE: [phpResource] multilevelscategories

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 ??

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedb adr.com/

 

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.

Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@ hotmail.com
Gmail:
rizwannawaz@ gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

============ =

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 ??

 

The table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id` )

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT= 7 ;

 

 

 

 


Lauren found her dream laptop. Find the PC that’s right for you.

 


#2731 From: Atif Majid <atif_majid10@...>
Date: Mon Jun 8, 2009 9:23 am
Subject: Re: [phpResource] multilevelscategories
atif_majid10
Offline Offline
Send Email Send Email
 
Try to use something like similar. May be it is buggy, but u can find an idea



include "YOUR DB CONNECTIVITY CLASS";
$objDB = new CREATEYOURDBObject();
$arrCategory = array();
getcategory($objDB, 0, 0, $arrCategory);
print_r($arrCategory);
function getcategory($objDB, $nParent, $nLevel, $arrCategory)
{
//$arrCategory = array();
$strQuery = "select * from hosp_categories where parent_id=".$nParent;
$nResult = $objDB->RUNQUERY($strQuery);
while ($rstRow=mysql_fetch_array($nResult)) {
$nID = $rstRow['category_id'];
$strSpace = "";
for ($i=0;$i<$nLevel;$i++)
{
$strSpace .= "&nbsp;";
}
$arrCategory[] = array("ID"=>$nID, "Title"=>$strSpace.$rstRow['title']);
$nCount = $objDB->RecordCount("hosp_categories", "parent_id=".$nID);
if($nCount>0)
{
getcategory($objDB, $nID, $nLevel+1, $arrCategory);
}
}
}
 
Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele.com



From: Mohamed BADR <badr@...>
To: phpresource@yahoogroups.com
Sent: Monday, June 8, 2009 11:15:25 AM
Subject: RE: [phpResource] multilevelscategories

I need a code example to do that

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedb adr.com/

 

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.

 

Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele. com

 

 


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 ??

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedbadr.com/

 

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.

Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@ hotmail.com
Gmail:
rizwannawaz@ gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

============ =

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 ??

 

The table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id` )

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT= 7 ;

 

 

 

 


Lauren found her dream laptop. Find the PC that’s right for you.

 



#2730 From: Muhammad Rizwan Nawaz <rizwan_nawaz786@...>
Date: Mon Jun 8, 2009 8:42 am
Subject: RE: [phpResource] multilevelscategories
rizwan051
Offline Offline
Send Email Send Email
 

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.

Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger: rizwan_nawaz786@...
Gmail: rizwannawaz@... 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681 

=============

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: 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.
 
Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele.com



From: Mohamed BADR <badr@mohamedbadr.com>
To: phpresource@yahoogroups.com
Sent: Monday, June 8, 2009 10:53:09 AM
Subject: RE: [phpResource] multilevelscategories


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 ??

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedb adr.com/

 

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.



Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@ hotmail.com
Gmail:
rizwannawaz@ gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

============ =

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 ??

 

The table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id` )

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT= 7 ;

 

 

 

 


Lauren found her dream laptop. Find the PC that’s right for you.





Hotmail® has ever-growing storage! Don’t worry about storage limits. Check it out.

#2732 From: "Mohamed BADR" <badr@...>
Date: Mon Jun 8, 2009 9:21 am
Subject: RE: [phpResource] multilevelscategories
badrm1000000
Offline Offline
Send Email Send Email
 

I need all cats, subcats to be in one select box, how do I do that ?

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedbadr.com/

 

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.

Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@...
Gmail:
rizwannawaz@... 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

=============

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: 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.

 

Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele.com

 

 


From: Mohamed BADR <badr@...>
To: phpresource@yahoogroups.com
Sent: Monday, June 8, 2009 10:53:09 AM
Subject: RE: [phpResource] multilevelscategories

 

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 ??

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedb adr.com/

 

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.


Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@ hotmail.com
Gmail:
rizwannawaz@ gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

============ =

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 ??

 

The table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id` )

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT= 7 ;

 

 

 

 


Lauren found her dream laptop. Find the PC that’s right for you.

 

 


Hotmail® has ever-growing storage! Don’t worry about storage limits. Check it out.


#2734 From: Muhammad Rizwan Nawaz <rizwan_nawaz786@...>
Date: Wed Jun 10, 2009 5:23 pm
Subject: RE: [phpResource] multilevelscategories
rizwan051
Offline Offline
Send Email Send Email
 

If you want all in one select box than you need to make a recursive function which call itself and fetch sub category untill reached last level.

Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger: rizwan_nawaz786@...
Gmail: rizwannawaz@... 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681 

=============

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@...
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 ?

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedbadr.com/

 

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.

Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@hotmail.com
Gmail:
rizwannawaz@gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

=============

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: 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.

 

Atif Majid
Software Developer.
Tawasul Telecom
Kuwait Free Zone, Block C-28, D9, Shuwaik, Kuwait
Phone: +965 2295 7164
Mobile: +965 6708 53 95
www.tawasultele.com

 

 


From: Mohamed BADR <badr@mohamedbadr.com>
To: phpresource@yahoogroups.com
Sent: Monday, June 8, 2009 10:53:09 AM
Subject: RE: [phpResource] multilevelscategories

 

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 ??

 

Mohamed Badr
Senior Web Application Developer

OmegaSoft Projects

mob: +2 010 2050009

website: http://www.mohamedb adr.com/

 

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.


Thanks
Best Regards,
Muhammad Rizwan Nawaz
Email / MSN Messenger:
rizwan_nawaz786@ hotmail.com
Gmail:
rizwannawaz@ gmail.com 
Yahoo IM: rizwan051
AOL IM: riznawaz
Skype: rizwannawaz
ICQ: 442047681
 

============ =

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 ??

 

The table is here

 

CREATE TABLE IF NOT EXISTS `hosp_categories` (

  `category_id` int(10) NOT NULL auto_increment,

  `parent_id` int(10) NOT NULL,

  `title` varchar(255) NOT NULL,

  `description` text NOT NULL,

  `image` varchar(255) NOT NULL default '',

  PRIMARY KEY  (`category_id` )

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT= 7 ;

 

 

 

 


Lauren found her dream laptop. Find the PC that’s right for you.

 

 


Hotmail® has ever-growing storage! Don’t worry about storage limits. Check it out.




Insert movie times and more without leaving Hotmail®. See how.

 
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help