I'm using the YouTube API to try and place JSON data from multiple URL's into a mySQL database. I'm trying to use the json decoder on multiple JSON links and at the moment my code removes the first array and overwrites it with the second. Please note that I do not want to use the array_merge function as I want to use around 6-7 json URLs. If you could be pretty specific that would be great too, as I'm very new to php.
$linkone = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId={playlistID}&key={Key}';
$linktwo = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId={PlaylistID}&key={Key}';
$content = file_get_contents($linkone);
$content2 = file_get_contents($linktwo);
$json = json_decode($content, true);
foreach($json['items'] as $row)
{
$title = $row['snippet']['title'];
$title = mysql_real_escape_string($title);
$description = $row['snippet']['description'];
$description = mysql_real_escape_string($description);
$publishedAt = $row['snippet']['publishedAt'];
$publishedAt = mysql_real_escape_string($publishedAt);
$high = $row['snippet']['thumbnails']['high']['url'];
$high = mysql_real_escape_string($high);
$sql = "INSERT INTO table(title, description, publishedAt, high) VALUES('".$title."','".$description."','".$publishedAt."','".$high."')";
if(!mysql_query($sql,$conn))
{
die('Error : ' . mysql_error());
}
}