Question

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?

Était-ce utile?

La solution

I found the answer, array_values is the solution:

$banners = R::findAll('banner');
$banners = array_values($banners);
$banner1 = $banners[2];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top