43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
// Set default timezone
|
|
date_default_timezone_set("Canada/Pacific");
|
|
|
|
$currentDBMode = "Previous";
|
|
require "/m/data1/app.hotlunches.net/include/config.php";
|
|
|
|
//connect to the database..
|
|
$_DB = mysql_connect($db_host,$db_uname,$db_pass)
|
|
or die("Cannot connect to database host: " . mysql_error());
|
|
mysql_select_db($db_dbname)
|
|
or die("The \"$db_dbname\" database does not exist: " . mysql_error());
|
|
|
|
|
|
// Define error-handling sql-query function
|
|
if (!function_exists('db_query')) {
|
|
function db_query($query) {
|
|
$r = db_query($query) or die($query . "<BR><BR>" . mysql_error());
|
|
return $r;
|
|
}
|
|
}
|
|
|
|
|
|
// sql query function to return a single row
|
|
if (!function_exists('db_getVal')) {
|
|
function db_getVal($query) {
|
|
$r = db_query($query);
|
|
if (db_num_rows($r) == 1) {
|
|
$data = mysql_fetch_row($r);
|
|
if (count($data) == 1) list($data) = $data;
|
|
}
|
|
else {
|
|
$data = '';
|
|
}
|
|
return $data;
|
|
}
|
|
}
|
|
|
|
// Set collation
|
|
db_query("SET NAMES 'utf8'");
|
|
|
|
?>
|