$result = $db->query("SELECT * FROM Pilots"); if(is_object($result)) { $var = $result->fetch_all(MYSQLI_ASSOC); $result->free(); } $id = $var['id'];