I have two sheets.
Table A ID name class number
Table B class number class Chinese name
In PHP, I want to show this
Software classes
Dick and Harry .....
Painting class
Harry........
How to express in PHP, in addition, I am using the smarty.
Reply to discussion (solution)
No use of smarty, direct SQL statements to find out, according to the way you want to show it can not do it.
Select A. class number, B. class Chinese name, Group_concat (A. Name) as Name_group from Table A a LEFT join table b b on A. Class number =b class number group by A. Class number
It's easy to get the query out.
Select A. class number, B. class Chinese name, Group_concat (A. Name) as Name_group from Table A a LEFT join table b b on A. Class number =b class number group by A. Class number
It's easy to get the query out.
Sorry, I mean, PHP can return a two-dimensional array.
No use of smarty, direct SQL statements to find out, according to the way you want to show it can not do it.
Can I return a two-dimensional array?
When the associated query comes out, use an array to process ...
PHP array