0
I am creating a website that aims to show the games that are happening in the world in real time. I’m trying to make a go for the rows of the tables to be created "alone" according to the amount of games you will have at the moment coming from the API, I’m using the bet365 API. Attempt I made:
<?php
for(i=0;i<=$transaction['results'];i++){
echo "<th></th>";
}
?>
Following photo with layout template:
Note: I wanted the colors to be interspersed also as shown in the photo.
To display the results I am using the following code:
foreach ($transaction['results'] as $element) {
echo $element['league']['name'].PHP_EOL;
echo $element['home']['name'].PHP_EOL;
echo $element['away']['name'].PHP_EOL;
}
JSON template coming from API
{
"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"
},
Do you intend to do all this via PHP? Because I believe that the ideal way would be to perform all the negotiations related to the organization of the table with Javascript, use PHP only to capture the API data and send to the Views in the IC. The IC itself already induces this structure.
– Vinicius Gabriel
I added the template that as comes the API codes, so yes I was thinking of doing everything in PHP.
– Eduarda Rosa