<?php $match1=$_GET['match1']; $sex=$_GET['sex']; include("selectbyclass_in_match.php"); include("conn.php");$result=mysql_query("select a.stu_id,a.user,a.sex,a.class,b.spo_name,a.is_houbu,a.mat_id from tb_match_mulper as a,tb_sport as b where a.spo_id='$match1' and a.sex='$sex' and a.spo_id=b.spo_id order by class,is_houbu");$info=@mysql_fetch_array($result,MYSQL_ASSOC); print_r($info); ?> <center> <?php foreach($info as $v) $t[$v['group']][]=$v; foreach($t as $v){ echo '<table>'; foreach($v as $n) echo "<tr><td>".join('</td><td>',$n)."</td></tr>"; echo '</table>'; } mysql_free_result($result); mysql_close($connID); ?>
结果没变,还是一大串的Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38Warning: join() [function.join]: Invalid arguments passed in F:\Website\www\project\teacher\text_2.php on line 38
2009052789 0003 男 2009电子商务 100米 0003 1
2009052795 狂了房 男 2009旅游管理 100米 0009 1
2009052794 uisfkjio 男 2009商英二班 100米 0008 1
2009052793 fvlsdjflj 男 2009酒店管理 100米 0007 1
2009052792 sdfksjdfk 男 2009旅游管理 100米 0006 1
2009052791 的份上 男 2009电子商务 100米 0005 1
2009052790 timesima 男 2009电子商务 100米 0004 1
2009052788 伍龙君 男 2009电子商务 100米 0002 1
2009051822 李鸿君 男 2009电子商务 100米 0013 2
2009052797 花费空间看 男 2009旅游管理 100米 0012 2看到最后一列的组号了吧?所有的组号的数据都在一个表格里显示,现在我想要的效果是每个组号都有一个表格,效果如下:
第一组:
学号 姓名 性别 班级 项目名称 参赛编号 组号
2009052789 0003 男 2009电子商务 100米 0003 1
2009052795 狂了房 男 2009旅游管理 100米 0009 1
2009052794 uisfkjio 男 2009商英二班 100米 0008 1
2009052793 fvlsdjflj 男 2009酒店管理 100米 0007 1
2009052792 sdfksjdfk 男 2009旅游管理 100米 0006 1
2009052791 的份上 男 2009电子商务 100米 0005 1
2009052790 timesima 男 2009电子商务 100米 0004 1 第二组:
学号 姓名 性别 班级 项目名称 参赛编号 组号
2009051822 李鸿君 男 2009电子商务 100米 0013 2
2009052797 花费空间看 男 2009旅游管理 100米 0012 2每8人一组,不足8人的为一组
$arr=array(
array('id'=>'2009052788' ,'name'=>'b', 'group'=>1),
array('id'=>'2009051822' ,'name'=>'c', 'group'=>2),
array('id'=>'2009052788' ,'name'=>'a', 'group'=>1),
array('id'=>'2009052797' ,'name'=>'d', 'group'=>2)
);foreach($arr as $v) $t[$v['group']][]=$v;
foreach($t as $v){
echo '<table>';
foreach($v as $n) echo "<tr><td>".join('</td><td>',$n)."</td></tr>";
echo '</table>';
}
这是怎么回事?
有了第二个参数也是不行的
$match1=$_GET['match1'];
$sex=$_GET['sex'];
include("selectbyclass_in_match.php");
include("conn.php");$result=mysql_query("select a.stu_id,a.user,a.sex,a.class,b.spo_name,a.is_houbu,a.mat_id from tb_match_mulper as a,tb_sport as b where a.spo_id='$match1' and a.sex='$sex' and a.spo_id=b.spo_id order by class,is_houbu");$info=@mysql_fetch_array($result,MYSQL_ASSOC);
print_r($info);
?>
<center>
<?php
foreach($info as $v) $t[$v['group']][]=$v;
foreach($t as $v){
echo '<table>';
foreach($v as $n) echo "<tr><td>".join('</td><td>',$n)."</td></tr>";
echo '</table>';
}
mysql_free_result($result);
mysql_close($connID);
?>
print_r($info); 去掉@ ,贴出结果
<td align="center" valign="top">
<?php
include("conn/conn.php");
if(!filter_var($_POST[materialid], FILTER_VALIDATE_INT))
{
$Row[MaterialID]="您输入的不是编号!";
$Row[MaterialNameEN]="您输入的不是编号!";
$Row[MaterialNameCN]="您输入的不是编号!";
$Row[Description]="您输入的不是编号!";
}
else
{ $query=mssql_query("select ParameterName,ParameterValue,ParameterUnit,Description from MaterialParaBro where MaterialID='".$_POST[materialid]."'");
$result=mssql_fetch_array($query);
if($result==false){
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center" id="tabletext">暂无参数信息!</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>
<?php
}else{
?>
<table width="100%" height="33px" border="0" cellspacing="0" cellpadding="0" >
<tr>
</tr>
</table>
<table width="100%" height="33px" cellpadding="0" cellspacing="1" border="1px solid #0c406d">
<tr align="center" bgcolor="#1c65a6" border="1px solid #0c406d">
<td width="30%" id="table">参数名称</td>
<td width="15%" id="table">参数值</td>
<td width="10%" id="table">参数单位</td>
<td width="45%" id="table">参数描述</td>
</tr>
<?php do{ ?>
<tr bgcolor="#cbcbcb" >
<td style="padding:5px; border-right-color:1px solid #0c406d" id="tabletext"> <?php echo $result[ParameterName];?></td>
<td style="padding:5px;" id="tabletext"> <?php echo $result[ParameterValue];?></td>
<td style="padding:5px;" id="tabletext"> <?php echo $result[ParameterUnit];?></td>
<td style="padding:5px;" id="tabletextde"> <?php echo $result[Description];?></td>
</tr>
<?
}while($result=mssql_fetch_array($query));
}}
?>
</table></td>
</tr>
</table>
</td>
</tr>
</tr>
<tr> </tr>
</table>
</td>