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 "
name |
Mobile phone |
Sex |
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 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.
}