Frage

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?

War es hilfreich?

Lösung

I found the answer, array_values is the solution:

$banners = R::findAll('banner');
$banners = array_values($banners);
$banner1 = $banners[2];
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top