Created At: 2026-06-14T16:05:07Z
Completed At: 2026-06-14T16:05:07Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 3856
Total Bytes: 159351
Showing lines 180 to 210
The following code has been modified to include a line number before every line, in the format: <line_number>: <original_line>. Please note that any changes targeting the original code should remove the line number, colon, and leading space.
180:     $cols_to_add = [
181:         'graph_base_value' => 'REAL DEFAULT NULL',
182:         'graph_uncertainty' => 'REAL DEFAULT NULL',
183:         'graph_ssp1_slope' => 'REAL DEFAULT NULL',
184:         'graph_ssp2_slope' => 'REAL DEFAULT NULL',
185:         'graph_ssp3_slope' => 'REAL DEFAULT NULL',
186:         'graph_ssp5_slope' => 'REAL DEFAULT NULL',
187:         'csv_data' => 'TEXT DEFAULT NULL',
188:         'image_climate_map_url_2' => "TEXT DEFAULT ''"
189:     ];
190:     foreach ($cols_to_add as $col_name => $col_def) {
191:         try {
192:             $db->exec("ALTER TABLE future_climate ADD COLUMN {$col_name} {$col_def}");
193:         } catch (PDOException $ex) {
194:             // Kolom sudah ada, abaikan saja
195:         }
196:     }
197: } catch (PDOException $e) {
198:     header('Content-Type: application/json');
199:     echo json_encode(['error' => 'Gagal terhubung ke database server.']);
200:     exit;
201: }
202: 
203: // Inisialisasi Tabel jika database baru dibuat atau masih kosong
204: if (!$db_exists || filesize($db_file) === 0) {
205:     try {
206:         $db->exec("
207:             CREATE TABLE IF NOT EXISTS locations (
208:                 id INTEGER PRIMARY KEY AUTOINCREMENT,
209:                 name TEXT UNIQUE NOT NULL,
210:                 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
The above content does NOT show the entire file contents. If you need to view any lines of the file which were not shown to complete your task, call this tool again to view those lines.
