数据库查询结果是多个单独的一维数组如何组成二维数组 50
在线等挺急的Array([0]=>Array([name]=>111[staus]=>1))Array([0]=>Array([name]=>222[staus]=>1)...
在线等挺急的
Array ( [0] => Array ( [name] => 111 [staus] => 1) )
Array ( [0] => Array ( [name] => 222 [staus] => 1) )
Array ( [0] => Array ( [name] => 333 [staus] => 1) )
如何转成下面这种二维数组
Array (
[0] => Array ( [name] => 111 [staus] => 1)
[1] => Array ( [name] => 222 [staus] => 1)
[2] => Array ( [name] => 33 [staus] => 1)
) 展开
Array ( [0] => Array ( [name] => 111 [staus] => 1) )
Array ( [0] => Array ( [name] => 222 [staus] => 1) )
Array ( [0] => Array ( [name] => 333 [staus] => 1) )
如何转成下面这种二维数组
Array (
[0] => Array ( [name] => 111 [staus] => 1)
[1] => Array ( [name] => 222 [staus] => 1)
[2] => Array ( [name] => 33 [staus] => 1)
) 展开
1个回答
展开全部
<?php$con = mysql_connect("localhost", "hello", "321");if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("test_db",$con);$sql = "SELECT * from Person WHERE Lastname='Adams'";$result = mysql_query($sql,$con);print_r(mysql_fetch_array($result)); mysql_close($con);?>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询