示例
$query = mysqli_query($db, "select name from documentation");
while ($row = mysqli_fetch_assoc($query)) {
print_r($row); echo "<br />";
}
Array ( [name] => Orders )
Array ( [name] => Documents )
Array ( [name] => Letters )
问题。如何拆分数组元素?
例如$ row [0]将是Orders; $ row [1] =&gt;文件;等......
提前谢谢。
答案 0 :(得分:0)
您可以初始化数组并在每次迭代中向其添加项目。
$myArray = [];
$query = mysqli_query($db, "select name from documentation");
while ($row = mysqli_fetch_assoc($query)) {
//Print what you need to print
$myArray[]=$row['name'];
}