eerikk2 Posted February 9, 2010 Share Posted February 9, 2010 Ok so i have a database named test a table named members and a column named people and another column named names. What i am trying to do is make link to the people. So for example under names there is Joseph Stevens, Anna Peterson, Jackson Smith... And each of these people fall under different people such as boss, manager, and worker. I wan to make links that find boss, manager, and worker and make those parent links then under those links are the name. For example: -Boss -Joseph Stevens -Anna Peterson -Manager -Jackson Smith -Worker -Andrew Simmons So if you were to click on Boss the php would search my database under people to find every names that is under the boss people. is there a way to do this in a semi simple way i've been trying out but i'm rather new to php and would appreciate the help. I'm not looking for the code to be written out. Possibly just the mysql query and a tutorial to make those pop out links. Thank you in advanced! Link to comment https://forums.phpfreaks.com/topic/191459-sorting-nav-according-to-name/ Share on other sites More sharing options...
Virvo Posted February 9, 2010 Share Posted February 9, 2010 you need a mysql query - do an inner join between people and names and order by people - then you can loop through an print them out. Link to comment https://forums.phpfreaks.com/topic/191459-sorting-nav-according-to-name/#findComment-1009273 Share on other sites More sharing options...
eerikk2 Posted February 9, 2010 Author Share Posted February 9, 2010 ok so i know how to do the loop. but what is a inner join? Link to comment https://forums.phpfreaks.com/topic/191459-sorting-nav-according-to-name/#findComment-1009288 Share on other sites More sharing options...
jl5501 Posted February 9, 2010 Share Posted February 9, 2010 If you can provide details of your table structure then we can provide example queries that will join the tables in the way you need Link to comment https://forums.phpfreaks.com/topic/191459-sorting-nav-according-to-name/#findComment-1009298 Share on other sites More sharing options...
eerikk2 Posted February 9, 2010 Author Share Posted February 9, 2010 ok so my table looks like this Names | People | viewid (autoinc) | details person 1 | Boss | 1 | paragraph description person 2 | Worker | 2 | paragraph description person 3 | Manager | 3 | paragraph description person 4 | worker | 4 | paragraph description person 5 | Manager | 5 | paragraph description so from that i currently have all the names listed by name in my side link panel and it links to page.php?id=(viewid) i want to separate the names into sub categories of the people so when you click Boss a sublink would come up and show all the bosses then link to their description page the links would look a little like this -Boss -person 1 -Manager -person 3 -person 5 Link to comment https://forums.phpfreaks.com/topic/191459-sorting-nav-according-to-name/#findComment-1009300 Share on other sites More sharing options...
jl5501 Posted February 9, 2010 Share Posted February 9, 2010 You have not given your tablename, but if it is called employees then your query will look something like this: select * from employess order by people,name Then, in your loop you would monitor the change in value of the People field, and control your output accordingly. If you can set up that query, and list the output from it, then we can help debug any issues you may have with your output control Link to comment https://forums.phpfreaks.com/topic/191459-sorting-nav-according-to-name/#findComment-1009302 Share on other sites More sharing options...
eerikk2 Posted February 10, 2010 Author Share Posted February 10, 2010 how do i "monitor the change in value of the People field"? Link to comment https://forums.phpfreaks.com/topic/191459-sorting-nav-according-to-name/#findComment-1009839 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.