prepare("INSERT INTO stations (station_code, station_name, latitude, longitude) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE station_name=VALUES(station_name), latitude=VALUES(latitude), longitude=VALUES(longitude)"); foreach ($station_data as $row) { $stmt->execute($row); } echo "Successfully seeded stations table with " . count($station_data) . " records.\n"; } catch (PDOException $e) { die("Database seeding failed: " . $e->getMessage() . "\n"); }