science-ation/scripts/conv_db_tours.inc.php
2025-02-12 02:22:50 +00:00

35 lines
934 B
PHP

<?php
$tours_map = array();
function conv_tours($mysqli, $old_prefix, $year)
{
global $tours_map;
print("Convert Tours for $year...\n");
/* Delete existing */
$mysqli->query("DELETE FROM tours WHERE year='$year' )");
$q=$mysqli->query("SELECT * FROM {$old_prefix}tours WHERE year='$year'");
while($r=$q->fetch_assoc()) {
$tid = tour_create($mysqli, $year);
$t = tour_load($mysqli, $tid);
$t['name'] = $mysqli->real_escape_string($r['name']);
$t['num'] = (int)$r['num'];
$t['description'] = $mysqli->real_escape_string($r['description']);
$t['capacity_min'] = (int)$r['capacity_min'];
$t['capacity_max'] = (int)$r['capacity'];
$t['grade_min'] = (int)$r['grade_min'];
$t['grade_max'] = (int)$r['grade_max'];
$t['contact'] = $mysqli->real_escape_string($r['contact']);
$t['location'] = $mysqli->real_escape_string($r['location']);
tour_save($mysqli, $t);
$tours_map[(int)$r['id']] = $tid;
}
}
?>