I have this json:
[{"nombre":"Example1","idcomplejo":"1","canchafk":"1","cantidadturnos":"35"},
{"nombre":"Example2","idcomplejo":"3","canchafk":"6","cantidadturnos":"29"},
{"nombre":"Example3","idcomplejo":"4","canchafk":"7","cantidadturnos":"6"},
{"nombre":"Example4","idcomplejo":"5","canchafk":"8","cantidadturnos":"4"},
{"nombre":"Example5","idcomplejo":"5","canchafk":"9","cantidadturnos":"2"}]
I wanna show in my table into my HTML page, but I have this error:
Invalid argument supplied for foreach()
This is the part of code where I getting the error:
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>ID Complejo></th>
<th># Cancha></th>
<th>Cantidad Turnos></th>
</tr>
</thead>
<tbody>
<?php foreach ($cantidadturnos as $turno): ?>
<tr>
<td><?= h($turno->idComplejo) ?></td>
<td><?= h($turno->canchaFK) ?></td>
<td><?= h($turno->cantidadTurnos) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
the var_dump of cantidadturnos is the json that i put above. Thanks for help