没有循环中的所有对象,这是我如何获得一个纪录的MySQLi:获取OOP的MySQLi
$result = $db->query("...");
$image = $result->fetch_object();
现在我需要的意见,并把它传递给视图。我现在这样做,但它看起来不正确:
$result = $db->query("...");
while ($row = $result->fetch_object())
$comments[] = $row;
我想知道是否有办法删除循环?喜欢的东西有$图像= $ result-> fetch_object(((S))),所以我的代码看起来像:
$result = $db->query("...");
$comments = $result->fetch_objects();