Created At: 2026-06-14T16:16:41Z
Completed At: 2026-06-14T16:16:41Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 3864
Total Bytes: 159803
Showing lines 480 to 520
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.
480:             }
481: 
482:             // Dapatkan atau buat Variabel
483:             $stmt = $db->prepare("SELECT id FROM variables WHERE name = :name");
484:             $stmt->execute([':name' => $variable]);
485:             $var = $stmt->fetch();
486:             if (!$var) {
487:                 $stmt_add = $db->prepare("INSERT INTO variables (name) VALUES (:name)");
488:                 $stmt_add->execute([':name' => $variable]);
489:                 $variable_id = $db->lastInsertId();
490:             } else {
491:                 $variable_id = $var['id'];
492:             }
493: 
494:             // Simpan (UPSERT)
495:             $stmt = $db->prepare("
496:                 INSERT INTO historical_climate (
497:                     location_id, variable_id, description, 
498:                     image_annual_url, image_trend_url, image_time_series_url, 
499:                     image_monthly_map_url, image_monthly_graph_url, updated_at
500:                 ) 
501:                 VALUES (:location_id, :variable_id, :description, :image_annual, :image_trend, :image_time_series, :image_monthly_map, :image_monthly_graph, CURRENT_TIMESTAMP)
502:                 ON CONFLICT (location_id, variable_id) 
503:                 DO UPDATE SET 
504:                     description = EXCLUDED.description,
505:                     image_annual_url = EXCLUDED.image_annual_url,
506:                     image_trend_url = EXCLUDED.image_trend_url,
507:                     image_time_series_url = EXCLUDED.image_time_series_url,
508:                     image_monthly_map_url = EXCLUDED.image_monthly_map_url,
509:                     image_monthly_graph_url = EXCLUDED.image_monthly_graph_url,
510:                     updated_at = CURRENT_TIMESTAMP
511:             ");
512: 
513:             $stmt->execute([
514:                 ':location_id' => $location_id,
515:                 ':variable_id' => $variable_id,
516:                 ':description' => $description,
517:                 ':image_annual' => $imageAnnual,
518:                 ':image_trend' => $imageTrend,
519:                 ':image_time_series' => $imageTimeSeries,
520:                 ':image_monthly_map' => $imageMonthlyMap,
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.
