Help with numbering groups
Posted: Tue Nov 23, 2010 10:58 am
Hello, I have a newbie problem and I don't know where to start. Basically I have a table which consists of car details. For example it is structured like:
Make | Model
-----------------
Audi | TT
Audi | TT
BMW | X5
Ford | Mondeo
BMW | 5 Series
Audi | A8
Ford | Mustang
I want to out put values from this table based on their make. But I would like with php to somehow detect the first make and number them 1, 2 , 3 ..., based on the make. Kind of like grouping the makes and numbering them within that group. For example:
1 Audi TT
2 Audi TT
3 Audi A8
1 Ford Mondeo
1 BMW X5
2 BMW 5 Series
1 Ford Mustang
Please can somebody point me in the right direction.
Thanks
Make | Model
-----------------
Audi | TT
Audi | TT
BMW | X5
Ford | Mondeo
BMW | 5 Series
Audi | A8
Ford | Mustang
I want to out put values from this table based on their make. But I would like with php to somehow detect the first make and number them 1, 2 , 3 ..., based on the make. Kind of like grouping the makes and numbering them within that group. For example:
1 Audi TT
2 Audi TT
3 Audi A8
1 Ford Mondeo
1 BMW X5
2 BMW 5 Series
1 Ford Mustang
Please can somebody point me in the right direction.
Thanks