Created At: 2026-06-14T16:16:17Z
Completed At: 2026-06-14T16:16:17Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 3856
Total Bytes: 159351
Showing lines 470 to 700
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.
470:             } else {
471:                 $location_id = $loc['id'];
472:             }
473: 
474:             // Dapatkan atau buat Variabel
475:             $stmt = $db->prepare("SELECT id FROM variables WHERE name = :name");
476:             $stmt->execute([':name' => $variable]);
477:             $var = $stmt->fetch();
478:             if (!$var) {
479:                 $stmt_add = $db->prepare("INSERT INTO variables (name) VALUES (:name)");
480:                 $stmt_add->execute([':name' => $variable]);
481:                 $variable_id = $db->lastInsertId();
482:             } else {
483:                 $variable_id = $var['id'];
484:             }
485: 
486:             // Simpan (UPSERT)
487:             $stmt = $db->prepare("
488:                 INSERT INTO historical_climate (
489:                     location_id, variable_id, description, 
490:                     image_annual_url, image_trend_url, image_time_series_url, 
491:                     image_monthly_map_url, image_monthly_graph_url, updated_at
492:                 ) 
493:                 VALUES (:location_id, :variable_id, :description, :image_annual, :image_trend, :image_time_series, :image_monthly_map, :image_monthly_graph, CURRENT_TIMESTAMP)
494:                 ON CONFLICT (location_id, variable_id) 
495:                 DO UPDATE SET 
496:                     description = EXCLUDED.description,
497:                     image_annual_url = EXCLUDED.image_annual_url,
498:                     image_trend_url = EXCLUDED.image_trend_url,
499:                     image_time_series_url = EX
<truncated 10910 bytes>
_url_2 = EXCLUDED.image_climate_map_url_2,
668:                     image_time_series_url = EXCLUDED.image_time_series_url,
669:                     image_climate_stripe_url = EXCLUDED.image_climate_stripe_url,
670:                     graph_base_value = EXCLUDED.graph_base_value,
671:                     graph_uncertainty = EXCLUDED.graph_uncertainty,
672:                     graph_ssp1_slope = EXCLUDED.graph_ssp1_slope,
673:                     graph_ssp2_slope = EXCLUDED.graph_ssp2_slope,
674:                     graph_ssp3_slope = EXCLUDED.graph_ssp3_slope,
675:                     graph_ssp5_slope = EXCLUDED.graph_ssp5_slope,
676:                     csv_data = EXCLUDED.csv_data,
677:                     updated_at = CURRENT_TIMESTAMP
678:             ");
679: 
680:             $stmt->execute([
681:                 ':location_id' => $location_id,
682:                 ':variable_id' => $variable_id,
683:                 ':period_id' => $period_id,
684:                 ':description' => $description,
685:                 ':image_climate_map' => $imageClimateMap,
686:                 ':image_climate_map_2' => $imageClimateMap2,
687:                 ':image_time_series' => $imageTimeSeries,
688:                 ':image_climate_stripe' => $imageClimateStripe,
689:                 ':graph_base_value' => $graphBaseValue,
690:                 ':graph_uncertainty' => $graphUncertainty,
691:                 ':graph_ssp1_slope' => $graphSSP1Slope,
692:                 ':graph_ssp2_slope' => $graphSSP2Slope,
693:                 ':graph_ssp3_slope' => $graphSSP3Slope,
694:                 ':graph_ssp5_slope' => $graphSSP5Slope,
695:                 ':csv_data' => $csvData
696:             ]);
697: 
698:             echo json_encode(['success' => true, 'message' => 'Data Future berhasil disimpan!']);
699:             exit;
700:         }
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.
