I'm creating a website that aims to show the games that are happening in the world in real time. I'm trying to make a for the table lines to be created "alone" according to the amount of games I will have at the moment I come from the API, I'm using the bet365 API. Attempt I made:
<?php
for(i=0;i<=$transaction['results'];i++){
echo "<th></th>";
}
?>
Here is a photo with the layout template:
Note:Iwantedthecolorstobeinterleavedalsoasshowninthephoto.
TodisplaytheresultsI'musingthefollowingcode:
foreach($transaction['results']as$element){echo$element['league']['name'].PHP_EOL;echo$element['home']['name'].PHP_EOL;echo$element['away']['name'].PHP_EOL;}
JSONmodelcomingfromtheAPI
{"success": 1,
"pager": {
"page": 1,
"per_page": 1000,
"total": 4
},
"results": [
{
"id": "77564080",
"time": "1543528800",
"time_status": "1",
"league": {
"id": "3024",
"name": "Copa Libertadores - Feminino"
},
"home": {
"id": "9105",
"name": "EC Iranduba - Feminino"
},
"away": {
"id": "170148",
"name": "Atlético Huila - Feminino"
},
"ss": "1-0",
"our_event_id": "1093051"
},