I get this Undefined offset: 0
$lasttrade = BaseDonnee::execQuery($bdd, "SELECT Price FROM Trade_History WHERE
Market='$ipair' ORDER BY Timestamp DESC LIMIT 1")[0]["Price"];
What is this problem? and how do I solve this? the BaseDonne::execQuery function is this
static function execQuery($bdd, $query){
try{
$req = $bdd->prepare($query);
$req->execute();
$result = $req->fetchAll(PDO::FETCH_ASSOC);
$req->closeCursor();
return $result;
} catch( PDOEXception $e ) {
echo $e->getMessage(); // display bdd error
exit();
}
}