未定义偏移量:使用while循环时,php中为0

时间:2019-07-10 12:44:08

标签: php mysqli while-loop

am在使用php从sql返回值并遇到此错误时遇到问题:

  

未定义的偏移量:0

这是我的代码

<?php
$connect = mysqli_connect("localhost","root", "","gocar");
$query = "SELECT * FROM `userdetails` u RIGHT JOIN `bookingdetails` b ON 
u.id=b.user_id ORDER by b.id DESC LIMIT 10";
$result = mysqli_query($connect,$query);
while ($row = mysqli_fetch_assoc($result)) 
{
print_r($row[0]);
}
?>

何时使用此

  

print_r($ row);

一切正常,并获得所有10个值...但是现在我需要获取特定的索引!

该怎么做??

0 个答案:

没有答案