What is the number of fields in a query array? Solution Ideas

Source: Internet
Author: User
What is the number of fields in a query array?
$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 " while ($row =mysql_fetch_assoc ($r)) { $shouji _arr=explode (', ', $row [' Shouji ']); $sex _arr=explode (', ', $row [' sex ']); echo " "; foreach (Explode (', ', $row [' name ']) as $k = + $v) { echo] "; echo " "; echo " "; }} echo "
name Mobile phone Sex
Order number: ". $row [OrderID]." Status: ". $row [' Zhuangtai ']."
$v $shouji _arr[$k] $sex _arr[$k]
";


This is an iteration of the loop output, and I want to know how to get
$v $shouji_arr[$k] $sex _arr[$k]
, what is the number of $v? That means, how to get the actual output to show after thisHow many lines are there? Because I need to add a merged cell, similar to theMerged cellsBecause I don't know this groupHow many lines, that is, the number of $v, so do not know rowspan This value is how much!


Do not know my statement, we do not hear clearly, is this foreach output display, but can not determine how many lines of output, need to get the number of $v, because a $v to occupy a row! MySQL PHP Table Border


------Solution--------------------
$t = Explode (', ', $row [' name ']);
$s = "The contents of the merged cell";
foreach ($t as $k = = $v) {
echo "" . $s;
echo "$v$shouji _arr[$k]$sex _arr[$k]";
echo "";
$s = "; Empty when the output is over.
}
  • 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.