【发布时间】:2016-07-15 09:52:07
【问题描述】:
我有这个只返回一行的函数,我该如何修改该函数使其返回多行?
public function getVisitors($UserID)
{
$returnValue = array();
$sql = "select * from udtVisitors WHERE UserID = '".$UserID. "'";
$result = $this->conn->query($sql);
if ($result != null && (mysqli_num_rows($result) >= 1)) {
$row = $result->fetch_array(MYSQLI_ASSOC);
if (!empty($row)) {
$returnValue = $row;
}
}
return $returnValue;
}
【问题讨论】:
-
固定数量的行还是所有选定的行?
-
所有选定的行,我尝试使用@HankyPanky 之前发送给我的行,但它检索到数组中的 1 行