Files
HotLunches/database-test.php
2026-10-19 15:22:52 -07:00

71 lines
1.8 KiB
PHP

<?php
$ValidAccess = 2010;
require_once("include/globals.php");
// Set default timezone
date_default_timezone_set("Canada/Pacific");
$now = date("Y-m-d H:i:s",time());
// Connect to hotlunch system
$db_host = "polarbear2";
$db_dbname = "schoolappointments";
$db_uname = "ezssoftwaredb";
$db_pass = "ezs7785422700@@";
include "include/database.pb2.php";
echo("Connecting to: $db_host\n");
db_close($_DB);
$_DB = new mysqli($db_host,$db_uname,$db_pass,$db_dbname);
if ($_DB->connect_errno) {
echo("Connect failed: $db_host\n");
exit();
}
db_query("SET NAMES utf8");
db_query("SET CHARACTER SET utf8");
$results = db_query("SELECT * FROM schools ORDER BY record_num LIMIT 0,1");
$row = db_fetch_assoc($results);
// print_r($row);
$payments = new Table("invoice_payments");
print_r($payments->column_names);
print_r($payments->column_types);
$invoice_num = "00007839";
$payment_date = date("Y-m-d", time());
$entered = time();
$amount = 387.00;
$currency = "CAD";
$method = "Cheque";
$user_ip = "187.190.40.204";
$group_with_next = 'N';
$batch_num = 0;
$batch_closed_date = NULL;
$entry = array();
if (isset($school_num)) $entry['school_num'] = $school_num;
if (isset($invoice_num)) $entry['invoice_num'] = $invoice_num;
if (isset($payment_date)) $entry['payment_date'] = $payment_date;
if (isset($entered)) $entry['entered'] = $entered;
if (isset($amount)) $entry['amount'] = $amount;
if (isset($currency)) $entry['currency'] = $currency;
if (isset($method)) $entry['method'] = $method;
if (isset($user_ip)) $entry['user_ip'] = $user_ip;
if (isset($group_with_next)) $entry['group_with_next'] = $group_with_next;
if (isset($batch_num)) $entry['batch_num'] = $batch_num;
if (isset($batch_closed_date)) $entry['batch_closed_date'] = $batch_closed_date;
if (isset($record_num)) $entry['record_num'] = $record_num;
$query = $payments->BuildInsert($entry);
echo("$query\n");
?>