Morning everyone,
My problem seems to be in my foreach loop but I cant see the issue.
When I print my array I get this from my select statment.
array(41) {
[0]=> array(4) {
["id"]=>
string(1) "1"
["name"]=>
string(14) "Indoor Cycling"
["time"]=>
string(12) "6.15am – 7am"
["day"]=>
string(1) "1"
}
[1]=> array(4) {
["id"]=>
string(2) "73"
["name"]=>
string(11) "Fast Blast "
["time"]=>
string(6) "7.10am"
["day"]=>
string(1) "5"
}
}
So I try the standard for each loop.
foreach ($rows as $timetableitems) {
$timetablearray[] = array(
'name' => $timetableitems->name,
'time' => $timetableitems->time,
);
}
But when I try and var dump my $timetablearray I get the following.
array(41) {
[0]=>
array(2) {
["name"]=>
NULL
["time"]=>
NULL
}
[1]=>
array(2) {
["name"]=>
NULL
["time"]=>
NULL
}
Any help would be most appreciated, thanks.