Jump to content

Problem with API Call in a table


paulmagm

Recommended Posts

Hey,

I have a table with match results.

<?php foreach ($matches as $match) { ?>

$match["matchResults"][0]["pointsTeam1"]

$match["matchResults"][1]["pointsTeam1"]

n the first line i have the score [1] (game finished)

on all other lines (td) i have the score [0] halftime score.

How can i change it that in every line i have [1] with finished score?

Maybe you can help me.

Thanks!

<?php

foreach ($matches as $match) {

?>

<tr><td></td>

<td><img src="<?php echo $match["team1"]["teamIconUrl"]; ?>" height="25"></td>

<td class="result"> <?php echo $match["matchResults"][1]["pointsTeam1"]; ?> : <?php echo $match["matchResults"][1]["pointsTeam2"]; ?>

</td>

<td><img src="<?php echo $match["team2"]["teamIconUrl"]; ?>" height="25"></td>

</tr>

<?php

}

?>

 

Thanks

Edited by paulmagm
Link to comment
Share on other sites

  • paulmagm changed the title to Problem with API Call in a table

I have 5 Games in that table. With the code in my first post.  It repeats automatic. the table lines.
Team1 Team2 2:1 (all fine)

Team1 Team2 1:1
Team1 Team2 0:0
Team1 Team2 0:0
Team1 Team2 0:0

 

But on the last 4 games i have the [0] haltime result not the [1] finished result like in the first game.

And i don't know why. Thanks for your time! 

Edit: Hm now it works.. maybe it was just in the cache? haha..

Edited by paulmagm
Link to comment
Share on other sites

I have two other questions (and last questions).

A. How can i echo a simple Array without the that $match and automatic repeat? Like 

<?php echo $match["group"]["groupName"]; ?>

 

B. How can i format that date which this API echo me like.

<?php echo $match["matchDateTime"]; ?>

I get back this 2024-10-06T09:19:53.660Z

I tried it often.. to bring it in Sa., 6.10. - 15:30.
But it doesn't work. I have often two dates then in my echo and no good format.

Thanks!

 

Edited by paulmagm
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.