Jump to content

sorting nav according to name


eerikk2

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.