prepare($sql); $stmt->bindValue(':driverID', $driverID); $stmt->execute(); } catch (PDOException $e) { // ‏بلا هذا الالتقاط كان أي خلل في القاعدة يصير 500 يُسقط الشاشة كلها. error_log('[driverStatistic] ' . $e->getMessage()); printFailure("Statistics unavailable"); exit; } if ($stmt->rowCount() > 0) { // Fetch the record $row = $stmt->fetchAll(PDO::FETCH_ASSOC); printSuccess( $row); } else{ // Print a failure message printFailure($message = "No wallet record found"); }