本文整理汇总了PHP中validate::genErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP validate::genErrors方法的具体用法?PHP validate::genErrors怎么用?PHP validate::genErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validate
的用法示例。
在下文中一共展示了validate::genErrors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: slctacc
function slctacc($_POST)
{
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($year, "string", 3, 4, "Invalid year.");
# display errors, if any
if ($v->isError()) {
$confirm = $v->genErrors();
$confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirm;
}
db_conn('core');
$Sl = "SELECT * FROM year WHERE yrdb='{$year}'";
$Ri = db_exec($Sl) or errDie("Unable to get data.");
$yd = pg_fetch_array($Ri);
global $PRDMON;
$fprds = finMonList("fprd", $PRDMON[1], false, $yd["yrname"]);
$tprds = finMonList("tprd", PRD_DB, false, $yd["yrname"]);
db_connect();
$sql = "SELECT * FROM stock WHERE div = '" . USER_DIV . "' ORDER BY stkdes ASC";
$stkRslt = db_exec($sql) or errDie("Could not retrieve Stock Information from the Database.", SELF);
if (pg_numrows($stkRslt) < 1) {
return "<li class='err'> There are no Stock Items in Cubit.</li>";
}
$stks = "<select name=stkids[] multiple size=10>";
while ($stk = pg_fetch_array($stkRslt)) {
$stks .= "<option value='{$stk['stkid']}'>{$stk['stkcod']} {$stk['stkdes']}</option>";
}
$stks .= "</select>";
$slctacc = "\n\t\t<p>\n\t\t<h3>Inventory Ledger</h3>\n\t\t<h4>Select Options</h4>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='viewtran'>\n\t\t\t<input type='hidden' name='year' value='{$year}'>\n\t\t\t<input type='hidden' name='fprd' value='{$fprd}'>\n\t\t\t<input type='hidden' name='tprd' value='{$tprd}'>\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Stock Items</td>\n\t\t\t\t<td><input type='radio' name='accnt' value='slct' checked='yes'>Selected Items | <input type='radio' name='accnt' value='all'>All Items</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td valign='top'>Select Stock Item(s)</td>\n\t\t\t\t<td>{$stks}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Select period</td>\n\t\t\t\t<td>{$fprds} to {$tprds}</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td align='center'></td>\n\t\t\t\t<td align='right'><input type='submit' value='Continue »'></td>\n\t\t\t</tr>\n\t\t</table>";
return $slctacc;
}
示例2: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($invid, "num", 1, 20, "Invalid invoice selection.");
if ($v->isError()) {
return edit($v->genErrors());
}
pglib_transaction("BEGIN");
$subtotal = 0;
if (isset($unitprices) && is_array($unitprices)) {
foreach ($unitprices as $id => $unitprice) {
$sql = "SELECT qty FROM cubit.inv_items WHERE id='{$id}'";
$qty_rslt = db_exec($sql) or errDie("Unable to retrieve qty.");
$qty = pg_fetch_result($qty_rslt, 0);
$sql = "\n\t\t\tUPDATE cubit.inv_items SET unitcost='{$unitprice}'\n\t\t\tWHERE id='{$id}'";
db_exec($sql) or errDie("Unable to update unit cost.");
$subtotal += $unitprice * $qty;
}
}
$vat = $subtotal / 100 * 14;
$total = $subtotal + $vat;
$sql = "\n\tUPDATE cubit.invoices SET total='{$total}', subtot='{$subtotal}', vat='{$vat}'\n\tWHERE invid='{$invid}'";
db_exec($sql) or errDie("Unable to update invoice totals.");
pglib_transaction("COMMIT");
return edit();
}
示例3: view
function view()
{
extract($_GET);
require_lib("validate");
$v = new validate();
$v->isOk($empnum, "num", 1, 20, "Invalid employee number.");
$v->isOk($id, "num", 1, 20, "Invalid payslip number.");
if ($v->isError()) {
$confirmCust = $v->genErrors() . "<br><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>";
return $confirmCust;
}
if (($emp = qryEmployee($empnum, "*")) === false) {
$emp = qryLEmployee($empnum, "*");
}
if (isset($rev)) {
$tbl = "salr";
} else {
$tbl = "salpaid";
}
$sql = "SELECT * FROM cubit.{$tbl} WHERE empnum='{$empnum}' AND id = '{$id}' AND div = '" . USER_DIV . "'";
$rslt = db_exec($sql) or errDie("Unable to read employee salary details from Cubit.");
if (pg_numrows($rslt) < 1) {
return "<li>Employee payment not found.</li>";
}
$pay = pg_fetch_array($rslt);
# Calculate gross salary from nettpay
$gross = $pay['salary'] - $pay['totallow'] - $pay['comm'] + $pay['totded'] + $pay['uif'] + $pay['paye'] + $pay['loanins'];
vsprint($gross);
# Layout
$slip = "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<td align='right'><font size='3' color='white'><b>Employee: </b></font></td>\n\t\t<td align='left'><b>{$emp['empnum']}</b></td>\n\t\t<td align='right'><font size='3' color='white'><b>Name: </b></font></td>\n\t\t<td align='left'><b>{$emp['fnames']}</b></td>\n\t\t<td align='right'><font size='3' color='white'><b>Surname: </b></font></td>\n\t\t<td align='left'><b>{$emp['sname']}</b></td>\n\t</tr>\n\t" . TBL_BR . "\n\t</table>\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Description</th>\n\t\t<th>Amount</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Gross Basic salary</td>\n\t\t<td align='center'>" . CUR . " {$gross}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Commission</td>\n\t\t<td align='center'>" . CUR . " {$pay['comm']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Low or interest-free loan</td>\n\t\t<td align='center'>" . CUR . " {$pay['loanins']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Interest rate charged by company</td>\n\t\t<td align='center'>{$emp['loanint']} %</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Deductions</td>\n\t\t<td align='center'>" . CUR . " {$pay['totded']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>UIF</td>\n\t\t<td align='center'>" . CUR . " {$pay['uif']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>PAYE</td>\n\t\t<td align='center'>" . CUR . " {$pay['paye']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Allowances</td>\n\t\t<td align='center'>" . CUR . " {$pay['totallow']}</td>\n\t</tr>\n\t" . TBL_BR . "\n\t<tr class='" . bg_class() . "'>\n\t\t<td><h3>Nett Income</h3></td>\n\t\t<td align='center'><b>" . CUR . " {$pay['salary']}</b></td>\n\t</tr>\n\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"));
return $slip;
}
示例4: printLea
function printLea($_POST)
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($f_day, "num", 1, 2, "Invalid from Date day.");
$v->isOk($f_month, "num", 1, 2, "Invalid from Date month.");
$v->isOk($f_year, "num", 1, 4, "Invalid from Date Year.");
$v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
$v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
$v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
# mix dates
$fromdate = $f_year . "-" . $f_month . "-" . $f_day;
$todate = $to_year . "-" . $to_month . "-" . $to_day;
$v->isOk($fromdate, "date", 1, 1, "Invalid from date.");
$v->isOk($todate, "date", 1, 1, "Invalid to date.");
if ($v->isError()) {
$err = $v->genErrors();
return $err;
}
if (isset($empnum)) {
$OUTPUT = genslip($empnum, $fromdate, $todate);
} else {
$OUTPUT = "";
$qry = new dbSelect("employees", "cubit", grp(m("cols", "empnum"), m("where", "div='" . USER_DIV . "'")));
$qry->run();
while ($row = $qry->fetch_array()) {
$OUTPUT .= paged(genslip($row["empnum"], $fromdate, $todate));
}
}
require "../tmpl-print.php";
}
示例5: settings
function settings()
{
extract($_POST);
db_conn('cubit');
$err = "";
$save = false;
if (isset($from)) {
$save = true;
require_lib("validate");
$v = new validate();
$v->isOk($sig, "string", 0, 255, "Invalid signature.");
$v->isOk($from, "email", 1, 255, "Invalid from e-mail address.");
$v->isOk($reply, "email", 0, 255, "Invalid reply e-mail address.");
$v->isOk($host, "string", 1, 255, "Invalid smtp server. You need to fill in the SMTP HOST field, you can get this from your ISP.<br>\n\t\t\t\tExamples: smtp.saix.net OR smtp.mweb.co.za");
if ($v->isError()) {
$err = $v->genErrors();
} else {
$sig = remval($sig);
$from = remval($from);
$reply = remval($reply);
$host = remval($host);
$Sl = "SELECT * FROM esettings";
$Ri = db_exec($Sl);
if (pg_num_rows($Ri) < 1) {
$Sl = "INSERT INTO esettings(sig,fromname,reply,smtp_host,smtp_auth,smtp_user,smtp_pass) VALUES\n\t\t\t\t('{$sig}','{$from}','{$reply}','{$host}','0','','')";
$Ri = db_exec($Sl);
} else {
$Sl = "UPDATE esettings SET sig='{$sig}',fromname='{$from}',reply='{$reply}',smtp_host='{$host}'";
$Ri = db_exec($Sl);
}
r2sListRestore("emailsettings");
}
}
$Sl = "SELECT * FROM esettings";
$Ri = db_exec($Sl);
$sd = pg_fetch_array($Ri);
if (!$save) {
$ex = "<li class=err>Please set your email settings & then click 'Update'</li>";
} else {
$ex = "<li class=err>Email settings saved</li>";
}
if (pg_num_rows($Ri) < 1) {
$sd['sig'] = "";
$sd['fromname'] = "";
$sd['reply'] = "";
$sd['smtp_host'] = "smtp.saix.net";
$exx = "<li class=err>These are default settings. If these settings do not work, contact your ISP for correct details.</li>";
} else {
$exx = "";
}
$sd = array_merge($sd, $_POST);
if (!isset($retdata)) {
$retdata = "";
}
$out = "<h3>Email Settings</h3>\n\t{$exx}\n\t{$ex}\n\t<br />\n\t{$err}\n\t<table " . TMPL_tblDflts . ">\n\t<form action='" . SELF . "' method=post>\n\t{$retdata}\n\t<tr>\n\t\t<th colspan='2'>Settings</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td align='center' colspan='2'><b>An asterisk (" . REQ . ") symbol marks required fields.</b></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Signature</td>\n\t\t<td><input type='text' size='25' name='sig' value='{$sd['sig']}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>" . REQ . " From E-mail Address</td>\n\t\t<td><input type='text' size='25' name='from' value='{$sd['fromname']}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Reply To E-mail Address</td>\n\t\t<td><input type='text' size='25' name='reply' value='{$sd['reply']}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>" . REQ . " SMTP Server</td>\n\t\t<td><input type='text' size='25' name='host' value='{$sd['smtp_host']}'></td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align=right><input type=submit value='Update »'></td>\n\t</tr>\n\t</form>\n\t</table>\n\t<p>\n\t<table boder=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th>Quick Links</th></tr>\n\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\n\t</table>";
return $out;
}
示例6: confirm
function confirm()
{
extract($_POST);
require_lib("validate");
$v = new validate();
$v->isOk($bankid, "num", 1, 30, "Invalid Bank Account.");
if ($v->isError()) {
$err = $v->genErrors();
return add($err);
}
$bank = qryBankAcct($bankid);
$OUT = "\n\t<h3>Banking Details Account</h3>\n\t<h4>Confirm entry (Please check the details)</h4>\n\t<form action='" . SELF . "' method='post'>\n\t<table " . TMPL_tblDflts . ">\n\t<input type='hidden' name='key' value='write'>\n\t<input type='hidden' name='bankid' value='{$bankid}'>\n\t<tr>\n\t\t<th>Field</th>\n\t\t<th>Value</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Bank</td>\n\t\t<td>{$bank['bankname']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Branch</td>\n\t\t<td>{$bank['branchname']} ({$bank['branchcode']})</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Account Name</td>\n\t\t<td>{$bank['accname']}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Account Number</td>\n\t\t<td>{$bank['accnum']}</td>\n\t</tr>\n\t" . TBL_BR . "\n\t<tr>\n\t\t<td><input type='submit' name='back' value='« Correction' /></td>\n\t\t<td align='right'><input type='submit' value='Write »' /></td>\n\t</tr>\n\t</table>\n\t</form>" . mkQuickLinks();
return $OUT;
}
示例7: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 9, "Invalid booking selection.");
if ($v->isError()) {
return enter($v->genErrors());
}
$sql = "DELETE FROM hire.bookings WHERE id='{$id}'";
db_exec($sql) or errDie("Unable to retrieve bookings.");
$OUTPUT = "<h3>Remove Booking</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Remove</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><li>Booking successfully removed</li></td>\r\n\t\t</tr>\r\n\t</table>";
return $OUTPUT;
}
示例8: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($wh_id, "num", 1, 9, "Invalid store id.");
if ($v->isError()) {
return enter($v->genErrors());
}
$sql = "UPDATE hire.hire_settings SET value='{$wh_id}' WHERE field='wh_id'";
db_exec($sql) or errDie("Unable to save store id.");
$OUTPUT = "<h3>Hire Settings</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='2'>Write</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><li>Successfully saved settings.</li></td>\r\n\t\t</tr>\r\n\t</table>";
return $OUTPUT;
}
示例9: validate
function validate()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($type_name, "string", 1, 255, "Invalid type name.");
if ($v->isError()) {
return enter($v->genErrors());
}
// Make sure we don't have another entry with the same name
$sql = "SELECT * FROM cubit.document_types WHERE type_name='{$type_name}'";
$dt_rslt = db_exec($sql) or errDie("Unable to retrieve document types.");
if (pg_num_rows($dt_rslt)) {
$errmsg = "<li class='err'>A document type with the same name exists.</li>";
return enter($errmsg);
}
}
示例10: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($name, "string", 1, 80, "Invalid type name.");
$v->isOk($descr, "string", 0, 255, "Invalid description.");
if ($v->isError()) {
return enter($v->genErrors());
}
if ($page_option == "Edit") {
$sql = "UPDATE cubit.asset_types SET name='{$name}', description='{$descr}' WHERE id='{$id}'";
} else {
$sql = "INSERT INTO cubit.asset_types (name, description) VALUES ('{$name}', '{$descr}')";
}
db_exec($sql) or errDie("Unable to save asset type.");
$OUTPUT = "\r\n\t\t<h3>{$page_option} Asset Type</h3>\r\n\t\t<form method='post' action='" . SELF . "'>\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Write</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td>Successfully Saved the Asset Type.</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</form>";
return $OUTPUT;
}
示例11: write
function write()
{
extract($_POST);
require_lib("validate");
$v = new validate();
$v->isOk($salespno, "num", 1, 10, "Invalid Sales Person number.");
$v->isOk($salesp, "string", 1, 255, "Invalid Sales Person name.");
if ($v->isError()) {
return $v->genErrors();
}
$cols = grp(m("salespno", $salespno), m("salesp", $salesp), m("com", $com), m("div", USER_DIV));
$qry = new dbUpdate("salespeople", "exten", $cols);
$qry->run(DB_INSERT);
if ($qry->affected() < 1) {
return "<li class=err>Unable to add sales person to Cubit.";
}
$write = "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Sales Person added to system</th>\n\t</tr>\n\t<tr class='text'><td>New Sales Person <b>{$salesp}</b>, has been\n\t\tsuccessfully added to the system.</td>\n\t</tr>\n\t</table>";
return $write;
}
示例12: confirm
function confirm()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($title, "string", 1, 255, "Invalid title.");
$v->isOk($team_id, "num", 1, 9, "Invalid team selection.");
if ($v->isError()) {
return enter($v->genErrors());
}
// Retrieve team name
$sql = "SELECT name FROM crm.teams WHERE id='{$team_id}'";
$team_rslt = db_exec($sql) or errDie("Unable to retrieve team.");
$team_name = pg_fetch_result($team_rslt, 0);
if (empty($team_name)) {
$team_name = "[None]";
}
$OUTPUT = "<h3>{$page_option} Main Todo</h3>\n\t<form method='post' action='" . SELF . "'>\n\t" . frmupdate_passon() . "\n\t<input type='hidden' name='key' value='write' />\n\t<input type='hidden' name='page_option' value='{$page_option}' />\n\t<input type='hidden' name='id' value='{$id}' />\n\t<input type='hidden' name='title' value='{$title}' />\n\t<input type='hidden' name='team_id' value='{$team_id}' />\n\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t<tr>\n\t\t\t<th colspan='2'>Confirm</th>\n\t\t</tr>\n\t\t<tr class='odd'>\n\t\t\t<td>Title</td>\n\t\t\t<td>{$title}</td>\n\t\t</tr>\n\t\t<tr class='even'>\n\t\t\t<td>Team Permissions</td>\n\t\t\t<td>{$team_name}</td>\n\t\t</tr>\n\t</table>\n\t<input type='submit' value='Write »' />\n\t</form>";
return $OUTPUT;
}
示例13: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($user_id, "num", 1, 20, "Invalid cubit user selection.");
$v->isOk($description, "string", 0, 255, "Invalid person description.");
if ($v->isError()) {
return enter($v->genErrors());
}
if (strtolower($page_option) == "edit") {
$sql = "\n\t\tUPDATE project.people SET user_id='{$user_id}', description='{$description}'\n\t\tWHERE id='{$id}'";
db_exec($sql) or errDie("Unable to add person");
} else {
$sql = "\n\t\tINSERT INTO project.people (user_id, description)\n\t\tVALUES ('{$user_id}', '{$description}')";
db_exec($sql) or errDie("Unable to add person.");
}
$OUTPUT = "<h3>{$page_option} Person</h3>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Write</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><li>Successfully saved the person to cubit.</li></td>\n\t\t</tr>\n\t</table>";
return $OUTPUT;
}
示例14: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($name, "string", 1, 255, "Invalid team name.");
$v->isOk($description, "string", 1, 255, "Invalid team description.");
if ($v->isError()) {
return enter($v->genErrors());
}
if (strtolower($page_option) == "edit") {
$sql = "\n\t\tUPDATE project.teams SET name='{$name}', description='{$description}'\n\t\tWHERE id='{$id}'";
db_exec($sql) or errDie("Unable to update team.");
} else {
$sql = "\n\t\tINSERT INTO project.teams (name, description)\n\t\tVALUES ('{$name}', '{$description}')";
db_exec($sql) or errDie("Unable to add team.");
}
$OUTPUT = "\n\t\t\t\t<h3>{$page_option} Project Management Team</h3>\n\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Write</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td><li>Successfully saved the team.</li></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
return $OUTPUT;
}
示例15: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($hd_perc, "num", 1, 9, "Invalid half day rate.");
if ($v->isError()) {
return enter($v->genErrors());
}
$sql = "SELECT value FROM cubit.settings WHERE constant='HD_PERC'";
$rslt = db_exec($sql) or errDie("Unable to retrieve percentage.");
if (pg_num_rows($rslt)) {
$sql = "\n\t\tUPDATE cubit.settings SET value='{$hd_perc}'\n\t\tWHERE constant='HD_PERC'";
} else {
$sql = "\n\t\tINSERT INTO cubit.settings (constant, value)\n\t\t\tVALUES ('HD_PERC', '{$hd_perc}')";
}
db_exec($sql) or errDie("Unable to update half day rate.");
$msg = "<li class='yay'>Successfully saved half day rate.</li>";
return enter($msg);
}