Jump to content

Group Headers...


dtyson2000

Recommended Posts

Hey there, folks.

 

I'm not sure where to start with this and really only need to be pointed in the right direction so I can figure it out. So I would appreciate any pointers you may be able to provide.

 

I have a query that selects all sorts of information from a database and one of those bits of information is CITY. The results pop up fine and everything is ordered by that particular field - CITY. Some cities have 10 results, others 1 and depending on the user input, they can all come out in one big list, which is fine and great and ok and whatever.

 

What I need is this:

 

I would like to be able to add some header text above each section of cities:

 

NEW YORK

1 | New York

2 | New York

3 | New York

 

Athens

1 | Athens

2 | Athens

 

Paris

1 | Paris

 

See what I mean?

 

Currently, I get:

 

Athens

1 | Athens

Athens

2 | Athens

 

So I've just got the city header running through the loop and echoing above each record. Again, I'd just like to echo it one time above a group of cities.

 

Any info would be appreciated. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/98616-group-headers/
Share on other sites

 

Are you using HTML tables? If not - create a table, and put PHP code in each section of the table that echos the correct variable you want to display. Use queries to store the correct information from the database into the variables and only display the ones you need.

 

 

- dhappy

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/98616-group-headers/#findComment-504790
Share on other sites

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.