153 lines
3.9 KiB
PHP
153 lines
3.9 KiB
PHP
<?php
|
|
include "db.php";
|
|
include "table.php";
|
|
|
|
$users = new Table("users");
|
|
$user_account = new Table("user_account");
|
|
$user_account_detail = new Table("user_account_detail");
|
|
$user_online_payments = new Table("user_online_payments");
|
|
$user_paypal_transactions = new Table("user_paypal_transactions");
|
|
$people = new Table("people");
|
|
$allergies = new Table("allergies");
|
|
$hotlunch_order_items = new Table("hotlunch_order_items");
|
|
$hotlunch_order_header = new Table("hotlunch_order_header");
|
|
|
|
$school_num = 251;
|
|
|
|
|
|
// Restore users
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM users WHERE school_num = $school_num AND type IN ('Parent','Administration Team','Schedule Team','Volunteer Administrator')");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $users->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore user_account
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM user_account WHERE school_num = $school_num");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $user_account->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore user_account_detail
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM user_account_detail WHERE school_num = $school_num");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $user_account_detail->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore user_online_payments
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM user_online_payments WHERE school_num = $school_num");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $user_online_payments->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore user_paypal_transactions
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM user_paypal_transactions WHERE school_num = $school_num");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $user_paypal_transactions->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore people
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM people WHERE school_num = $base_school_num AND people_type IN ('Student','Customer')");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $people->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore allergies
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM allergies WHERE school_num = $school_num");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $allergies->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore hotlunch_order_items
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM hotlunch_order_items WHERE school_num = $school_num");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $hotlunch_order_items->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Restore hotlunch_order_header
|
|
db_query("USE hotlunch_prev");
|
|
$results = db_query("SELECT * FROM hotlunch_order_header WHERE school_num = $school_num");
|
|
$data = array();
|
|
while ($row = db_fetch_assoc($results)) {
|
|
$data[] = $row;
|
|
}
|
|
|
|
db_query("USE hotlunch");
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$query = $hotlunch_order_header->BuildInsert($data[$i],'Yes');
|
|
db_query($query);
|
|
}
|
|
|
|
|