Query the number of touch fields in the array? Solution

Source: Internet
Author: User
Query the number of touch fields in the array? $ R = mysql_query ('select & nbsp; orderid, zhuangtai, group_concat ('name') & nbsp; as & nbsp; name, group_concat ('shouji ') & how many fields does the nb search array contain?
$ R = mysql_query ('select orderid, zhuangtai, group_concat ('name') as name, group_concat ('shouji ') as shouji, group_concat ('sex ') as sex from 'order' group by orderid ');
Echo" ";
Echo"NameMobile phoneGender";
While ($ row = mysql_fetch_assoc ($ r )){
$ Shouji_arr = explode (',', $ row ['shouji ']);
$ Sex_arr = explode (',', $ row ['sex']);
Echo" Order Number: ". $ row [orderid]." status: ". $ row ['zhuangtai']."";
Foreach (explode (',', $ row ['name']) as $ k => $ v ){
Echo"";
Echo"$ V$ Shouji_arr [$ k]$ Sex_arr [$ k]";
Echo"";
}
}
Echo"";


This is a loop output column. I want to know how to get it.
$v$shouji_arr[$k]$sex_arr[$k]
Where is the number of $ v? After the actual output is displayedHow many rows are there? Because I need to add a merged cell, similar Merged cellsBecause I don't know this groupThe number of rows in the table, that is, the number of $ v. Therefore, we do not know the value of rowspan!


I don't know what I said, but you can't hear it clearly. this is the foreach output display, but you cannot determine the number of output rows. you need to get the number of $ v because one $ v occupies one row! Mysql php table border
------ Solution --------------------
$ T = explode (',', $ row ['name']);
$ S =" Merged cell content";
Foreach ($ t as $ k => $ v ){
Echo"". $ S;
Echo"$ V$ Shouji_arr [$ k]$ Sex_arr [$ k]";
Echo"";
$ S = ''; // clear after the output
}

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.