如何重写PHP和MySQL以按相等的列值对HTML列表进行分组?
技术问答
258 人阅读
|
0 人回复
|
2023-09-12
|
我有一个看起来像这样的数据库表:
: v+ a, B3 F$ @& |Business Phone City State CountryBaker CityName 1 StateName 1 CountryName 1Mason CityName 2 StateName 2 CountryName 1Welder 5814918 5814918CityName 3 StateName 1 CountryName 1Painter 48194918 CityName 4 StateName 3 CountryName 2Chef CityName 5 StateName 4 CountryName 3Vendor CityName 1 StateName 1 CountryName 1我有这个PHP和MySQL在我的网页上生成一个无序列表: E9 Z* V( {. O: a
</u></u></u></u></u>";}?>这是我的html:
& s( }4 G* g6 U2 F$ f& u输出如下:
n C% t& F' i0 f CountryName 1 - StateName * CityName * Vendor | 9692824 CountryName 1 - StateName * CityName * Baker | 12345678 CountryName 1 - StateName * CityName 3 * Welder | 58149918 CountryName 1 - StateName 2 * CityName 2 * Mason | 91834919 CountryName 2 - StateName 3 * CityName * Painter | 48194918我希望这样输出:
& a$ S& a$ v0 f/ K CountryName 1 - StateName * CityName * Vendor | 9692824 * Baker |12345678 * CityName 3 * Welder |5814918 - StateName 2 * CityName 2 * Mason | 91834919 CountryName 2 - StateName 3 * CityName * Painter | 48194918 CountryName 3 - StateName * CityName 5 * Chef | 95982848为了实现这个目标,我必须做哪些改变?3 B; ^ k7 k) C3 x" X( v2 ?
我发现这比我现在写的要复杂得多。
$ V1 G' j/ k" P& F! G
% h$ C. d# ] Y- y 解决方案: |
|
|
|
|
|