To merge and display the same data, I use the SQL output data format as follows: leaders | Zhang San leaders | Li Si leaders | Wang Wu & nbsp; to display the data in a table: leaders | Zhang San & nbsp; | Li Si & nbsp; | how can I implement this? ------ solution ------------------ PHPcode $ aarray (array (lead, Zhang San), array (lead, merge and display the same data)
The data format output through SQL is as follows:
Lead | Zhang San
Lead | Li Si
Lead | Wang Wu
The expected table format is as follows:
Lead | Zhang San
| Li Si
| Wang Wu
How can this problem be achieved?
------ Solution --------------------
PHP code
$ A = array ('authorization', 'Zhang San'), array ('authorization', 'Li si'), array ('authorization', 'Wang Wu ')); foreach ($ a as $ k => $ B) {if (! $ Tem [$ B [0]) $ tem [$ B [0] = $ B; else $ a [$ k] [0] = '';} echo"
"; Foreach ($ a as $ v) {echo"
"; Echo"
". $ V [0]." | "; Echo"
| ". $ V [1]." | "; Echo"
";} Echo"
";
------ Solution --------------------
PHP code
Header ("content-type: text/html; charset = utf-8"); $ a = array ('authorization', 'zhangsan'), array ('authorization ', 'Lee 4'), array ('Leader ', 'Wang 5'); echo"
"; Foreach ($ a as $ k => $ v) {echo"
"; If ($ k = 0) {echo"
". $ V [0]." | "; Echo"
| ". $ V [1]." | ";} Else {echo"
|
| ". $ V [1]." | ";} Echo"
";} Echo"
";