سؤال

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