Created At: 2026-06-14T15:33:27Z
Completed At: 2026-06-14T15:33:27Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 4711
Total Bytes: 198658
Showing lines 650 to 730
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.
650:             }
651: 
652:             // Check if record exists for this specific location, variable, and period
653:             $stmtCheck = $db->prepare("SELECT id FROM future_climate WHERE location_id = :location_id AND variable_id = :variable_id AND period_id = :period_id");
654:             $stmtCheck->execute([':location_id' => $location_id, ':variable_id' => $variable_id, ':period_id' => $period_id]);
655:             $existing = $stmtCheck->fetch();
656: 
657:             if ($existing) {
658:                 // UPDATE existing record - only fields that are explicitly provided in $input
659:                 $updates = [];
660:                 $params = [':id' => $existing['id']];
661:                 
662:                 // Map & Stripe fields
663:                 if (isset($input['description'])) { $updates[] = "description = :description"; $params[':description'] = trim($input['description']); }
664:                 if (isset($input['imageClimateMap'])) { $updates[] = "image_climate_map_url = :image_map"; $params[':image_map'] = trim($input['imageClimateMap']); }
665:                 if (isset($input['imageClimateMap2'])) { $updates[] = "image_climate_map_url_2 = :image_map_2"; $params[':image_map_2'] = trim($input['imageClimateMap2']); }
666:                 if (isset($input['imageClimateStripe'])) { $updates[] = "image_climate_stripe_url = :image_stripe"; $params[':image_stripe'] = trim($input['imageClimateStripe']); }
667:                 if (isset($input['imageTimeSeries'])) { $updates[] = "image_time_series_url = :image_ts"; $params[':image_ts']
<truncated 3274 bytes>
SSP5Slope'] !== '') ? floatval($input['graphSSP5Slope']) : null;
698:                 $csv = isset($input['csvData']) ? $input['csvData'] : null;
699: 
700:                 $stmtInsert = $db->prepare("
701:                     INSERT INTO future_climate (
702:                         location_id, variable_id, period_id, description, 
703:                         image_climate_map_url, image_climate_map_url_2, image_time_series_url, image_climate_stripe_url,
704:                         graph_base_value, graph_uncertainty, graph_ssp1_slope, graph_ssp2_slope, graph_ssp3_slope, graph_ssp5_slope,
705:                         csv_data, updated_at
706:                     ) VALUES (
707:                         :location_id, :variable_id, :period_id, :description,
708:                         :img_map, :img_map_2, :img_ts, :img_stripe,
709:                         :base_val, :uncertainty, :ssp1, :ssp2, :ssp3, :ssp5,
710:                         :csv_data, CURRENT_TIMESTAMP
711:                     )
712:                 ");
713:                 $stmtInsert->execute([
714:                     ':location_id' => $location_id,
715:                     ':variable_id' => $variable_id,
716:                     ':period_id' => $period_id,
717:                     ':description' => $desc,
718:                     ':img_map' => $imgMap,
719:                     ':img_map_2' => $imgMap2,
720:                     ':img_ts' => $imgTS,
721:                     ':img_stripe' => $imgStripe,
722:                     ':base_val' => $baseVal,
723:                     ':uncertainty' => $uncertainty,
724:                     ':ssp1' => $ssp1,
725:                     ':ssp2' => $ssp2,
726:                     ':ssp3' => $ssp3,
727:                     ':ssp5' => $ssp5,
728:                     ':csv_data' => $csv
729:                 ]);
730:             }
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.
