本文整理汇总了PHP中getNewNum函数的典型用法代码示例。如果您正苦于以下问题:PHP getNewNum函数的具体用法?PHP getNewNum怎么用?PHP getNewNum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getNewNum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rtrim
if ($num_po_dtl > 0) {
$nArrItems = rtrim($nArrItems, "|");
}
if (isset($_POST['update'])) {
$difference = $_POST['difference'];
$paymentterm = $_POST['payment_terms'];
$item = explode(":", $_POST['txtItemsArr']);
$price = explode(":", $_POST['txtPricesArr']);
$discount = str_replace(",", "", $_POST['discount']);
$subtotal = str_replace(",", "", $_POST['subtotal']);
$vat = str_replace(",", "", $_POST['vat']);
$totalamount = str_replace(",", "", $_POST['total_amount']);
switch ($_POST['status']) {
case 1:
//UPDATE
$rrrefno = getNewNum('RECEIVING_REPORT');
$rr_mst = "INSERT INTO tbl_rr_mst(rr_reference_no,rr_date,po_reference_no,received_by,received_date,discount,sub_total,vat,total_amount)\n\t\t\t\t\t\t\t\t\tVALUES('{$rrrefno}','{$today}','{$id}','{$_SESSION['username']}','{$today}','{$discount}',\n\t\t\t\t\t\t\t\t\t\t\t'{$subtotal}',\n\t\t\t\t\t\t\t\t\t\t\t'{$vat}',\n\t\t\t\t\t\t\t\t\t\t\t'{$totalamount}')";
$res = mysql_query($rr_mst) or die("SAVING RR " . mysql_error());
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'RECEIVING_REPORT' ";
mysql_query($update_controlno);
$cnt = 1;
$ttlrrqty = 0;
for ($i = 0; $i < count($item); $i++) {
$itemcode = $item[$i];
$itemprice = $price[$i];
$qty = $_POST['txt' . $itemcode];
$ttlrrqty += $qty;
// $sql_item = "SELECT * FROM tbl_items WHERE item_code = '$itemcode'";
$sql_item = "SELECT tbl_items.item_code,tbl_items.item_description,tbl_parts.part_onhand AS onhand,'parts' AS item_type\n\t\t\t\t\t\t\t\t\t\tFROM tbl_items\n\t\t\t\t\t\t\t\t\t\t\tJOIN tbl_parts ON tbl_parts.item_code = tbl_items.item_code\n\t\t\t\t\t\t\t\t\t\tWHERE tbl_items.item_code = '{$itemcode}'\n\n\t\t\t\t\t\t\t\t\t\tUNION\n\n\t\t\t\t\t\t\t\t\t\tSELECT tbl_items.item_code,tbl_items.item_description,tbl_material.material_onhand AS onhand,'material' AS item_type\n\t\t\t\t\t\t\t\t\t\tFROM tbl_items\n\t\t\t\t\t\t\t\t\t\t\tJOIN tbl_material ON tbl_material.item_code = tbl_items.item_code\n\t\t\t\t\t\t\t\t\t\tWHERE tbl_items.item_code = '{$itemcode}'\n\n\t\t\t\t\t\t\t\t\t\tUNION\n\n\t\t\t\t\t\t\t\t\t\tSELECT tbl_items.item_code,tbl_items.item_description,tbl_accessory.access_onhand AS onhand,'lubricants' AS item_type\n\t\t\t\t\t\t\t\t\t\tFROM tbl_items\n\t\t\t\t\t\t\t\t\t\t\tJOIN tbl_accessory ON tbl_accessory.item_code = tbl_items.item_code\n\t\t\t\t\t\t\t\t\t\tWHERE tbl_items.item_code = '{$itemcode}'";
$qry_item = mysql_query($sql_item);
while ($row = mysql_fetch_array($qry_item)) {
示例2: str_replace
break;
case 1:
$payment = "payment_id = 'PAY00000003'";
break;
case 2:
$payment = "payment_id = 'PAY00000004'";
break;
default:
break;
}
$qrybillingdtl = "SELECT * FROM v_for_billing_detail WHERE customer_id = '{$custid}' AND {$payment}";
$resbillingdtl = $dbo->query($qrybillingdtl);
if (isset($_POST['billed']) && !empty($_POST['billed']) && $_POST['billed'] == 1) {
$total_amnt = str_replace(",", "", $_POST['txtGrandTotal']);
$sql = null;
$newrefno = getNewNum('BILLING');
$sql3 = null;
foreach ($_REQUEST['chkworefno'] as $val) {
$sql1 = null;
$sql2 = null;
$val = explode("#", $val);
$wo = $val[0];
$amnt = $val[1];
$sql1 = "INSERT INTO tbl_billing(wo_refno,billing_refno,billing_date,total_amount)\n\t\t\t\t\tVALUES('{$wo}','{$newrefno}','{$today}','{$amnt}'); ";
$sql2 = "UPDATE tbl_service_master SET trans_status = '6' WHERE wo_refno = '{$wo}'; ";
mysql_query($sql1);
mysql_query($sql2);
}
$sql3 = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'BILLING'; ";
$res = mysql_query($sql3);
if (!$res) {
示例3: session_start
<?php
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['save'])) {
$package = $_POST['package'];
$newnum = getNewNum('PACKAGE');
$employee_insert = "INSERT INTO tbl_package_master (package_id,package_name,created_by,created_date) VALUES\n\t\t('" . $newnum . "',\n\t\t'" . $package . "',\n\t\t'" . $_SESSION['username'] . "',\n\t\t'" . $today . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'PACKAGE' ";
$res = mysql_query($employee_insert) or die("INSERT EMPLOYEE " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your package profile! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Package profile successfully saved.");</script>';
}
echo '<script>window.location="package_list.php";</script>';
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</script>
</head>
<body>
示例4: session_start
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
$qry_items = "SELECT * FROM v_items WHERE status = '1' ORDER BY item_description";
$result_items = $dbo->query($qry_items);
if (isset($_POST['save'])) {
$parts = strtoupper($_POST['parts']);
$parts_discount = str_replace(",", "", $_POST['parts_discount']);
$part_srp = str_replace(",", "", $_POST['part_srp']);
$part_onhand = $_POST['part_onhand'];
$parts_lowstock = $_POST['parts_lowstock'];
$partstatus = $_POST['partstatus'];
$new_price_date = date("Y-m-d h:i:s");
$item_code = $_POST['item_code'];
$newnum = getNewNum('PARTS');
$parts_insert = "INSERT INTO tbl_parts (parts_id, parts, parts_discount, part_srp, part_onhand, parts_lowstock, partstatus, part_created, new_price_date,item_code) VALUES\n\t\t('" . $newnum . "',\n\t\t'" . $parts . "',\n\t\t'" . $parts_discount . "',\n\t\t'" . $part_srp . "',\n\t\t'" . $part_onhand . "',\n\t\t'" . $parts_lowstock . "',\n\t\t'" . $partstatus . "',\n\t\t'" . $today . "',\n\t\t'" . $new_price_date . "',\n\t\t'" . $item_code . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'PARTS' ";
$res = mysql_query($parts_insert) or die("INSERT PARTS " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your parts! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Parts successfully saved.");</script>';
}
echo '<script>window.location="parts_list.php";</script>';
}
?>
<html>
<head>
<title></title>
示例5: session_id
$ses_id = session_id();
require_once "conf/db_connection.php";
require_once "functions.php";
if (isset($_POST['save']) && !empty($_POST['save']) && $_POST['save'] == 1) {
$customerid = $_POST['customer_id'];
$vehicleid = $_POST['plateno'];
$payment = $_POST['paymentmode'];
$remarks = $_POST['txtremarks'];
$subtotal = trim(str_replace(",", "", $_POST['subtotal']));
$discount = trim(str_replace(",", "", $_POST['discount']));
$discounted_price = trim(str_replace(",", "", $_POST['discounted_price']));
$vat = $_POST['vat'];
$total_amount = trim(str_replace(",", "", $_POST['totalamount']));
$qrytempestimate = "SELECT * FROM v_temp_estimate WHERE ses_id = '{$ses_id}'";
$restempestimate = $dbo->query($qrytempestimate);
$estimate_refno = getNewNum('ESTIMATEREFNO');
$sql = null;
$sql .= "INSERT INTO tbl_service_master\n\t\t\t(estimate_refno,transaction_date,customer_id,vehicle_id,payment_id,subtotal_amount,discount,discounted_price,vat,total_amount,created_by,remarks)\n\t\t\tVALUES('{$estimate_refno}','{$today}','{$customerid}','{$vehicleid}','{$payment}','{$subtotal}','{$discount}','{$discounted_price}','{$vat}','{$total_amount}','{$ses_UserID}','{$remarks}'); ";
foreach ($restempestimate as $rowtempestimate) {
$sql .= "INSERT INTO tbl_service_detail\n\t\t\t\t(estimate_refno,type,id,amount)\n\t\t\t\tVALUES('{$estimate_refno}','{$rowtempestimate['type']}','{$rowtempestimate['id']}','{$rowtempestimate['rate']}'); ";
}
$sql .= "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'ESTIMATEREFNO'; ";
$sql .= "DELETE FROM tbl_temp_estimate WHERE ses_id = '{$ses_id}'; ";
$qry = $dbo->query($sql);
if (!$qry) {
echo '<script>alert("There has been an error on saving your service! Please double check all the data and save.");</script>';
} else {
echo '<script>alert("Service successfully saved.");</script>';
}
echo '<script>window.location="estimate.php";</script>';
}
示例6: foreach
$subtotal = $_POST['subtotal'];
$discount = $_POST['discount'];
$vat = $_POST['vat'];
$discounted_price = $_POST['discounted_price'];
$total_amount = $_POST['totalamount'];
$remarks = $_POST['remarks'];
$file = $_FILES['txtattachment']['name'];
$qry = null;
$getqryservice = "SELECT * FROM v_service_master WHERE estimate_refno = '{$estimaterefno}'";
$getresservice = $dbo->query($getqryservice);
foreach ($getresservice as $rowresservice) {
$worefno = $rowresservice['wo_refno'];
}
$getqrytemppodetail = "SELECT * FROM v_temp_po_detail WHERE ses_id = '{$ses_id}'";
$getrestemppodetail = $dbo->query($getqrytemppodetail);
$new_refno = getNewNum('PURCHASEORDER');
if (!empty($file)) {
$upload_path = 'attachments/';
$ext = substr($file, strpos($file, '.'), strlen($file) - 1);
$attachment = $new_refno . $ext;
move_uploaded_file($_FILES['txtattachment']['tmp_name'], $upload_path . $attachment);
}
$qry .= "INSERT INTO tbl_po_master(estimate_refno,wo_refno,po_refno,attachment,transaction_date,payment_id,subtotal_amount,discount,discounted_price,vat,total_amount,remarks,created_by)\n\t\t\t\tVALUES('{$estimaterefno}','{$worefno}','{$new_refno}','{$attachment}','{$today}','{$payment}','{$subtotal}','{$discount}','{$discounted_price}','12','{$total_amount}','{$remarks}','asdf'); ";
foreach ($getrestemppodetail as $rowTEMPPODETAIL) {
$qry .= "INSERT INTO tbl_po_detail(po_refno,type,description,amount)\n\t\t\t\t\tVALUES('{$new_refno}','{$rowTEMPPODETAIL['type']}','{$rowTEMPPODETAIL['description']}','{$rowTEMPPODETAIL['amount']}'); ";
}
$qry .= "UPDATE tbl_service_master SET po_refno = '{$new_refno}' WHERE estimate_refno = '{$estimaterefno}'; ";
$qry .= "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'PURCHASEORDER'; ";
$qry .= "DELETE FROM tbl_temp_po_detail WHERE ses_id = '{$ses_id}'; ";
$res = $dbo->query($qry);
$msg = "created";
示例7: v_service_master
}
if (!empty($estimateno)) {
$where .= " AND estimate_refno LIKE '{$estimateno}%'";
}
$qryservices = new v_service_master();
$resservices = $dbo->query($qryservices->Query($where));
}
if (isset($_POST['option']) && !empty($_POST['option']) && $_POST['option'] == 1) {
$cntERNo = count($_POST['chkEstimateRefNo']);
if ($cntERNo > 0) {
switch ($_POST['opt']) {
case 1:
$cnt = 1;
$qry = null;
foreach ($_REQUEST['chkEstimateRefNo'] as $val) {
$new_refno = getNewNum('WORKORDER', $cnt);
$qry .= "UPDATE tbl_service_master SET wo_refno = '{$new_refno}', trans_status = '1' WHERE estimate_refno = '{$val}'; ";
$cnt++;
}
$qry .= "UPDATE tbl_controlno SET lastseqno = (lastseqno + {$cnt}) WHERE control_type = 'WORKORDER'; ";
$res = $dbo->query($qry);
$msg = "approved";
break;
case 2:
$qry = null;
foreach ($_REQUEST['chkEstimateRefNo'] as $val) {
$qry .= "UPDATE tbl_service_master SET trans_status = '2' WHERE estimate_refno = '{$val}'; ";
}
$res = $dbo->query($qry);
$msg = "disapproved";
break;
示例8: session_start
<?php
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['save'])) {
$desc = $_POST['description'];
$newnum = getNewNum('PAYMENT_TERM');
$payment_term_insert = "INSERT INTO tbl_payment_term (payment_term_code,description,created_date) VALUES \n\t \t('" . $newnum . "',\n\t \t'" . $desc . "',\n\t \t'" . $today . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'PAYMENT_TERM' ";
$res = mysql_query($payment_term_insert) or die("INSERT PAYMENT TERM " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your payment term! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Payment term successfully saved.");</script>';
}
echo '<script>window.location="payment_term_list.php";</script>';
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</head>
<body>
<form method="post" name="payment_term_form" class="form" onsubmit="return ValidateMe();">
<fieldset form="form_payment_term" name="form_payment_term">
示例9: trim
$serial = $_POST['serial'];
$remarks = $_POST['txtremarks'];
$payment = $_POST['paymentmode'];
$subtotal = trim(str_replace(",", "", $_POST['subtotal']));
$discount = trim(str_replace(",", "", $_POST['discount']));
$discounted_price = trim(str_replace(",", "", $_POST['discounted_price']));
$vat = $_POST['vat'];
$total_amount = trim(str_replace(",", "", $_POST['totalamount']));
if ($_POST['txtrecommendation']) {
$recommendation = $_POST['txtrecommendation'];
} else {
$recommendation = null;
}
$qrytempestimate = "SELECT * FROM v_temp_estimate WHERE ses_id = '{$ses_id}'";
$restempestimate = $dbo->query($qrytempestimate);
$oe_no = getNewNum('ONLINE_ESTIMATE');
$sql = null;
$sql .= "INSERT INTO tbl_online_estimate_master\n\t\t\t(oe_id,transaction_date,customer,address,contactno,emailaddress,plateno,year,make,model,color,variant,engineno,chassisno,serialno,remarks,recommendation,payment_id,subtotal_amount,discount,discounted_price,vat,total_amount)\n\t\t\tVALUES('{$oe_no}','{$today}','{$customer}','{$address}','{$contactno}','{$emailaddress}','{$plateno}','{$year}','{$make}','{$model}','{$color}','{$variant}','{$engine}','{$chassis}','{$serial}','{$remarks}','{$recommendation}','{$payment}','{$subtotal}','{$discount}','{$discounted_price}','{$vat}','{$total_amount}'); ";
foreach ($restempestimate as $rowtempestimate) {
$sql .= "INSERT INTO tbl_online_estimate_detail\n\t\t\t\t(oe_id,type,id,amount)\n\t\t\t\tVALUES('{$oe_no}','{$rowtempestimate['type']}','{$rowtempestimate['id']}','{$rowtempestimate['rate']}'); ";
}
$sql .= "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'ONLINE_ESTIMATE'; ";
$sql .= "DELETE FROM tbl_temp_estimate WHERE ses_id = '{$ses_id}'; ";
$qry = $dbo->query($sql);
if (!$qry) {
echo '<script>alert("There has been an error on saving your service! Please double check all the data and save.");</script>';
} else {
echo '<script>alert("Service successfully saved. Please print a copy, this will serve as your reference.");</script>';
}
echo '<script>window.open("online_estimate_print.php?oe_id=' . $oe_no . '");</script>';
// echo '<script>window.location="estimate_add1.php";</script>';
示例10: session_start
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
$qry_items = "SELECT * FROM v_items WHERE status = '1' ORDER BY item_description";
$result_items = $dbo->query($qry_items);
if (isset($_POST['save'])) {
$accessory = strtoupper($_POST['accessory']);
$access_disc = str_replace(",", "", $_POST['access_disc']);
$access_srp = str_replace(",", "", $_POST['access_srp']);
$access_onhand = $_POST['access_onhand'];
$access_low = $_POST['access_low'];
$access_status = $_POST['access_status'];
$item_code = $_POST['item_code'];
$newnum = getNewNum('ACCESSORY');
$accessory_insert = "INSERT INTO tbl_accessory (accessory_id, accessory, access_disc, access_srp, access_onhand, access_low, access_status, access_created, item_code) VALUES \n\t\t('" . $newnum . "',\n\t\t'" . $accessory . "',\n\t\t'" . $access_disc . "',\n\t\t'" . $access_srp . "',\n\t\t'" . $access_onhand . "',\n\t\t'" . $access_low . "',\n\t\t'" . $access_status . "',\n\t\t'" . $today . "',\n\t\t'" . $item_code . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'ACCESSORY' ";
$res = mysql_query($accessory_insert) or die("INSERT ACCESSORY " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your accessory! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Accessory successfully saved.");</script>';
}
echo '<script>window.location="accessory_list.php";</script>';
}
?>
<html>
<head>
<title></title>
示例11: session_start
<?php
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['save'])) {
$make = strtoupper($_POST['make']);
$make_rate = str_replace(",", "", $_POST['make_rate']);
$newnum = getNewNum('MAKE');
$make_insert = "INSERT INTO tbl_make (make_id, make, make_rate, make_created) VALUES\n\t\t('" . $newnum . "',\n\t\t'" . $make . "',\n\t\t'" . $make_rate . "',\n\t\t'" . $today . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'MAKE' ";
$res = mysql_query($make_insert) or die("INSERT MAKE " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your make! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Make successfully saved.");</script>';
}
echo '<script>window.location="make_list.php";</script>';
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</script>
示例12: session_start
<?php
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['save'])) {
$idle_name = strtoupper($_POST['idle_name']);
$newnum = getNewNum('IDLE');
$idle_insert = "INSERT INTO tbl_idle (idle_id, idle_name, idle_created) VALUES\n\t\t('" . $newnum . "',\n\t\t'" . $idle_name . "',\n\t\t'" . $today . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'IDLE' ";
$res = mysql_query($idle_insert) or die("INSERT IDLE " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your idle! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Idle successfully saved.");</script>';
}
echo '<script>window.location="idle_list.php";</script>';
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</head>
<body>
<form method="post" name="color_form" class="form" onSubmit="return ValidateMe();">
示例13: session_start
<?php
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['save'])) {
$wocat = strtoupper($_POST['wocat']);
$newnum = getNewNum('WOCATEGORY');
$wocat_insert = "INSERT INTO tbl_wocat (wocat_id, wocat, wocat_created) VALUES\n\t\t('" . $newnum . "',\n\t\t'" . $wocat . "',\n\t\t'" . $today . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'WOCATEGORY' ";
$res = mysql_query($wocat_insert) or die("INSERT WOCAT " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your work order category! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Work order category successfully saved.");</script>';
}
echo '<script>window.location="wocategory_list.php";</script>';
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</head>
<body>
<form method="post" name="wocat_form" class="form" onSubmit="return ValidateMe();">
<fieldset form="form_wocat" name="form_wocat">
示例14: session_start
<?php
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['save'])) {
$color = strtoupper($_POST['color']);
$newnum = getNewNum('COLOR');
$color_insert = "INSERT INTO tbl_color (color_id,color,color_created) VALUES\n\t\t('{$newnum}','{$color}','{$today}') ";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'COLOR' ";
$res = mysql_query($color_insert) or die("INSERT COLOR " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your color! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Color successfully saved.");</script>';
}
echo '<script>window.location="color_list.php";</script>';
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</script>
</head>
<body>
<form method="post" name="color_form" class="form" onSubmit="return ValidateMe();">
示例15: session_start
<?php
require_once "conf/db_connection.php";
require_once "functions.php";
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['save'])) {
$desc = $_POST['description'];
$newnum = getNewNum('ITEM_TYPE');
$item_type_insert = "INSERT INTO tbl_item_type (item_type_code,description,created_date) VALUES \n\t \t('" . $newnum . "',\n\t \t'" . $desc . "',\n\t \t'" . $today . "')";
$update_controlno = "UPDATE tbl_controlno SET lastseqno = (lastseqno + 1) WHERE control_type = 'ITEM_TYPE' ";
$res = mysql_query($item_type_insert) or die("INSERT ITEM TYPE " . mysql_error());
if (!$res) {
echo '<script>alert("There has been an error on saving your Item Type! Please double check all the data and save.");</script>';
} else {
mysql_query($update_controlno);
echo '<script>alert("Item Type successfully saved.");</script>';
}
echo '<script>window.location="item_type_list.php";</script>';
}
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style/cal.css" />
<link rel="stylesheet" type="text/css" href="style/forms.css" />
</head>
<body>
<form method="post" name="item_type_form" class="form" onsubmit="return ValidateMe();">
<fieldset form="form_item_type" name="form_item_type">