Ok this works but its only getting the latest item added
$database = new OrderTable();
$gamesList = $database->readtbl();
$database2 = new GamesTable();
foreach ($gamesList as $game) :
$view->checkOutList = $database2->checkoutGames($game->getItem());
endforeach;
Thats the code where something is going wrong. gamesList gets all the items from the OrderTable (I checked with a echo, all items get put in it) I then use the ID inside gamesList to match it with item ids in GamesTable. Its working, but only the 1 item is added, the latest one. I need it to get all the items from the GamesTable, that match the id in gamesList array
Array foreachloop
Moderator: General Moderators
Re: Array foreachloop
Then make ->checkOutList be an array. Right now it's just one value and inside your loop you keep overwriting the previous.