我有以下获取单行的代码:
$query = "SELECT *
FROM translations
WHERE iddoc = '$id'
AND submitted = 1;";
$result = mysqli_query($query);
$row = mysqli_fetch_array($result);
我知道这在 while 循环中很有用,您可以在其中循环遍历结果。
但我需要能够抓取满足此条件的特定行。这个伪代码后面的东西:
$query = "SELECT *
FROM translations
WHERE iddoc = '$id'
AND submitted = 1;";
$result = mysqli_query($query);
$arrayofrows = mysqli_fetch_arrayofrows($result);
$arrayofrows[0] //(to get the first row)
$arrayofrows[1] //(2nd row)
等等...
我怎样才能做到这一点?