$final_result = array()
for($i=0$i<$count$i++){
//压进数组
$single_record = array(
0=>$_POST['color'][$i],
1=>$_POST['size'][$i],
2=>$_POST['number'][$i]
)
array_push($final_result, $single_record)
//插入数据库
$sql = "INSERT INTO table VALUES('".$_POST['color'][$i]."','".$_POST['size'][$i]."','".$_POST['number'][$i]."')"
mysql_query($sql)
}
$a=array(0=>array("name"=>"a","mail"=>"b"),1=>array("name"=>"d","mail"=>"e"))function addkey(&$val, $key, $param)
{
$val[$param['key']] = $param['val']
}
array_walk($a,'addkey',array('key'=>'tel', 'val'=>'123'))
print_r($a)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)