I'm new to APIs and PHP but for an assignment at university I'm having to pull data from an API and display it. I currently have the following code working but I can't figure out how to make it display each Pokemon name separately in a table so that I can add images and other data into each cell with it:
<?php
$base = "http://pokeapi.co/api/v2/pokemon/";
for($id = 1; $id < 13; $id++){
$data = file_get_contents($base.$id.'/');
$pokemon = json_decode($data);
echo $pokemon->name."<br>";
}
?>
Any takers? I know it's probably an easy fix, I'm just so new to this and everything I try breaks the code.