我试图检索4行,我希望它应该显示所有4行,但它只显示第一行。这是我正在使用的代码
$coquery = "Select distinct coName from avgcarcompany"; $crun = mysqli_query($con,$coquery); $arrey = mysqli_fetch_assoc($crun); print_r($arrey);
iszxjhcz1#
如果要从结果集中获取所有行,则需要获取所有行。现在你只得到一个。要获取所有行,请使用 fetch_all() ```$coquery = "Select distinct coName from avgcarcompany";$crun = $con->query($coquery);
fetch_all()
$arrey = $crun->fetch_all(MYSQLI_ASSOC)
print_r($arrey);
1条答案
按热度按时间iszxjhcz1#
如果要从结果集中获取所有行,则需要获取所有行。现在你只得到一个。
要获取所有行,请使用
fetch_all()
```$coquery = "Select distinct coName from avgcarcompany";
$crun = $con->query($coquery);
$arrey = $crun->fetch_all(MYSQLI_ASSOC)
print_r($arrey);