My hope was that you’d use my snippet of code to learn about the differences yourself and fix the rest of your code appropriately…
<?php
include("_mysql.php");
$mysqli = new mysqli($host, $user, $pwd, $db);
$streams = $mysqli->query("SELECT * FROM ".PREFIX."streams");
while ($ds = $streams->fetch_assoc()) {
$streamID = $ds['streamID'];
$channel = $ds['channel'];
$type = $ds['type'];
switch($type) {
case 1: // Twitch Stream API
$twitch_api = 'https://api.twitch.tv/kraken/streams/'.$channel;
$twitch_json = json_decode(@file_get_contents($twitch_api));
if ($twitch_json && $twitch_json->stream) {
$live = 1;
$viewers = $twitch_json->stream->viewers;
$thumb = $twitch_json->stream->preview->large;
} else {
$live = 0;
}
break;
}
$query = "UPDATE ".PREFIX."streams SET status='".$live."', viewers='".$viewers."', thumb='".$thumb."' WHERE streamID='".$streamID."'";
$result = $mysqli->query($query);
}
$mysqli->close();
?>