natasha_thomas Posted February 22, 2011 Share Posted February 22, 2011 Folks, I have a flat file or CSV, which has the tree structure of the Nesed Categories (All are delimited by either > or tab, it can be set easily). I want a PHP/Mysql code/routine that i can automaticaly create a table in MYsql with Parent Child relationship. Logic is there in my mind, every distinct Node will be an ID which while every child node will have the PID (parent ID) of its Parent. So the below data from flat file (Actual Data can be N Level Deep at least 4 Level): Electronics Electronics > Phones Electronics > Phones > Iphone Electronics > Phones > LG Electronics > Phones > Samsung Electronics > Phones > Samsung > 3G Electronics > Laptops Electronics > Laptops > Dell Electronics > Laptops > Sony Electronics > Laptops > HP Electronics > Laptops > HP > Core 2 Duo Will look like this in Mysql Table Structure: http://pastie.org/1592730 This is the Logic i need ot adopt, but i have no clue on how to code it to extract in this table structure and define this paren tchild mapping automatically. Can someone Help me out wiht this? Cheers Natasha T Quote Link to comment https://forums.phpfreaks.com/topic/228469-auto-nested-categories-from-flat-file/ Share on other sites More sharing options...
trq Posted February 22, 2011 Share Posted February 22, 2011 You would need to write a script for this, MySql won't do it alone. Quote Link to comment https://forums.phpfreaks.com/topic/228469-auto-nested-categories-from-flat-file/#findComment-1178094 Share on other sites More sharing options...
natasha_thomas Posted February 22, 2011 Author Share Posted February 22, 2011 Yes i am aware of it. All i wanted to ask is, since this logic of Nested Categories is Very common and widely used, so does someone already haev any Prebuilt Mysql Routine of PHP codes.... Cheers NT Quote Link to comment https://forums.phpfreaks.com/topic/228469-auto-nested-categories-from-flat-file/#findComment-1178103 Share on other sites More sharing options...
trq Posted February 22, 2011 Share Posted February 22, 2011 Yes i am aware of it. Then you'll want to ask your question in one of the programming boards. Quote Link to comment https://forums.phpfreaks.com/topic/228469-auto-nested-categories-from-flat-file/#findComment-1178368 Share on other sites More sharing options...
natasha_thomas Posted February 23, 2011 Author Share Posted February 23, 2011 Thrope, May you please move on this post to PHP Prog. Board? seems i dnt have access to that functionality on this Forum.... Cheers Quote Link to comment https://forums.phpfreaks.com/topic/228469-auto-nested-categories-from-flat-file/#findComment-1178606 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.