我将此结果作为mysql_fetch_row函数返回数据库中的行...
Array
(
[firstname] => abc
[lastname] => xyz
[password] => abc
[gender] => female
[city] => malborne
[email] => abc@gmail.com
[address] => abc
)
我希望这个数组为
Array
(
[0] array(
[firstname] => abc
[lastname] => xyz
[password] => abc
[gender] => female
[city] => malborne
[email] => abc@gmail.com
[address] => abc
)
)
答案 0 :(得分:1)
$newArray = array($data);
print_r($newArray);
输出:
Array
(
[0] => Array
(
[firstname] => abc
[lastname] => xyz
[password] => abc
[gender] => female
[city] => malborne
[email] => abc@gmail.com
[address] => abc
)
)
答案 1 :(得分:0)
这很容易,您可以通过将其插入另一个数组
来创建所需的结构$original = array(.....);
$final = array($original);
答案 2 :(得分:0)
$myArray = array();
while($row = mysql_fetch_row(...)) {
$myArray[] = $row;
}
// $myArray is your final array