I'm quite new to PhP; My website suddenly stopped working tonight for no reason and once I have debugged my PDO script, it returns this error:
Cannot use object of type stdClass as array in /var/www/html/v1/framework/api/stats.php:5 Stack trace: #0 /var/www/html/v1/framework/radio_stats.php(5): include() #1 /var/www/html/v1/index.php(5): include('/var/www/html/v...') #2 {main}
I don't know if I'm doing something wrong, but everything seems to have broken.
$api = json_decode(file_get_contents('https://guardi.wearebounce.net/api/nowplaying'));
if($api[0]->live->is_live == "true"){
$return["presenter"] = $api[0]->live->streamer_name;
$stmt = $pdo->query("SELECT * FROM `users` WHERE `username` = '".$return["presenter"]."'");
$presenter = $stmt->fetch(PDO::FETCH_ASSOC);
$presentera = $presenter["likes"];
}else{
$return["presenter"] = "AutoDJ";
$presentera = -1;
$presenter["avatar"] = "https://wearebounce.net/branding/LogoIconColour.png";
}
Aucun commentaire:
Enregistrer un commentaire