문제

I am using RedBeanPHP this way:

$banners = R::findAll('banner');

After that i wanted to access each element by its index, says:

$banner1 = $banners[2];

But that way RedBeanPHP try to retrieve a banner which column id = 2 in the database table

What is the way to access elements by the index result?

도움이 되었습니까?

해결책

I found the answer, array_values is the solution:

$banners = R::findAll('banner');
$banners = array_values($banners);
$banner1 = $banners[2];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top