Questions about merging and displaying the same data-php Tutorial

Source: Internet
Author: User
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" 
     "; Echo" 
     "; Echo" 
    ";} Echo" 
   
". $ V [0]."| ". $ V [1]."
";
------ 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" 
       "; Echo" 
       ";} Else {echo" 
       ";} Echo" 
      ";} Echo" 
     
". $ V [0]."| ". $ V [1]." | ". $ V [1]."
";

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.