//定义一个数组,用于保存读取到的数据
$contents = array();
$query = mysql_query("select * from expreform");
//遍历数据表
while($array = mysql_fetch_array($query)){
$contents[] = $array;
}
print_r($contents);输出结果为Array
(
[0] => Array
(
[0] => 1
[id] => 1
[1] => 顺丰
[exprename] => 顺丰
[2] => 20
[exprejia] => 20
)
[1] => Array
(
[0] => 2
[id] => 2
[1] => 圆通
[exprename] => 圆通
[2] => 15
[exprejia] => 15
)
[2] => Array
(
[0] => 3
[id] => 3
[1] => 韵达
[exprename] => 韵达
[2] => 10
[exprejia] => 10
)
[3] => Array
(
[0] => 4
[id] => 4
[1] => 锋利
[exprename] => 锋利
[2] => 0
[exprejia] => 0
)
)如果我想要Array
(
[0] => Array
(
[id] => 1
[exprename] => 顺丰
[exprejia] => 20
)
[1] => Array
(
[id] => 2
[exprename] => 圆通
[exprejia] => 15
)
[2] => Array
(
[id] => 3
[exprename] => 韵达
[exprejia] => 10
)
[3] => Array
(
[id] => 4
[exprename] => 锋利
[exprejia] => 0
)
)或者Array
(
[0] => Array
(
[0] => 1
[1] => 顺丰
[2] => 20
)
[1] => Array
(
[0] => 2
[1] => 圆通
[2] => 15
)
[2] => Array
(
[0] => 3
[1] => 韵达
[2] => 10
)
[3] => Array
(
[0] => 4
[1] => 锋利
[2] => 0
)
)应该如何修改?
1 回答
- 1 回答
- 0 关注
- 1063 浏览
添加回答
举报
0/150
提交
取消